- 05 8月, 2016 1 次提交
-
-
由 Sean Griffin 提交于
So this bug is kinda funky. The code path is basically "if we weren't passed an instance of the class we compose to, and we have a converter, call that". Ignoring the hash case for a moment, everything after that was roughly intended to be the "else" clause, meaning that we are expected to have an instance of the class we compose to. Really, we should be blowing up in that case, as we can give a much better error message than what they user will likely get (e.g. `NameError: No method first for String` or something). Still, Ruby is duck typed, so if the object you're assigning responds to the same methods as the type you compose to, knock yourself out. The hash case was added in 36e9be85 to remove a bunch of special cased code from multiparameter assignment. I wrongly assumed that the only time we'd get a hash there is in that case. Multiparameter assignment will construct a very specific hash though, where the keys are integers, and we will have a set of keys covering `1..part.size` exactly. I'm pretty sure this could actually be passed around as an array, but that's a different story. Really I should convert this to something like `class MultiParameterAssignment < Hash; end`, which I might do soon. However for a change that I'm willing to backport to 4-2-stable, this is what I want to go with for the time being. Fixes #25978
-
- 31 5月, 2016 1 次提交
-
-
由 Sean Griffin 提交于
This behavior was broken by 36e9be85. When the value is assigned directly, either through mass assignment or directly assigning a hash, the hash gets passed through to this writer method directly. While this is intended to handle certain cases, when an explicit converter has been provided, we should continue to use that instead. The positioning of the added guard caused the new behavior to override that case. Fixes #25210
-
- 26 1月, 2016 1 次提交
-
-
由 Paulo Ancheta 提交于
-
- 14 10月, 2015 1 次提交
-
-
由 Yves Senn 提交于
The focus of this change is to make the API more accessible. References to method and classes should be linked to make it easy to navigate around. This patch makes exzessiv use of `rdoc-ref:` to provide more readable docs. This makes it possible to document `ActiveRecord::Base#save` even though the method is within a separate module `ActiveRecord::Persistence`. The goal here is to bring the API closer to the actual code that you would write. This commit only deals with Active Record. The other gems will be updated accordingly but in different commits. The pass through Active Record is not completely finished yet. A follow up commit will change the spots I haven't yet had the time to update. /cc @fxn
-
- 17 9月, 2015 1 次提交
-
-
由 yui-knk 提交于
-
- 20 5月, 2015 1 次提交
-
-
由 amitkumarsuroliya 提交于
-
- 21 2月, 2015 1 次提交
-
-
由 Rafael Mendonça França 提交于
These methods are nodoc so we should not document them.
-
- 08 2月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
This allows us to remove `Type::Value#klass`, as it was only used for multi-parameter assignment to reach into the types internals. The relevant type objects now accept a hash in addition to their previous accepted arguments to `type_cast_from_user`. This required minor modifications to the tests, since previously they were relying on the fact that mulit-parameter assignement was reaching into the internals of time zone aware attributes. In reaility, changing those properties at runtime wouldn't change the accessor methods for all other forms of assignment.
-
- 19 11月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
We added a comparison to "id", and call to `self.class.primary_key` a *lot*. We also have performance hits from `&block` all over the place. We skip the check in a new method, in order to avoid breaking the behavior of `read_attribute`
-
- 29 9月, 2014 1 次提交
-
-
由 Ben Woosley 提交于
Isolate access to @associations_cache and @aggregations cache to the Associations and Aggregations modules, respectively. This includes replacing the `association_cache` accessor with a more limited `association_cached?` accessor and making `clear_association_cache` and `clear_aggregation_cache` private.
-
- 07 6月, 2014 2 次提交
-
-
由 Sean Griffin 提交于
As we move towards removing the `klass` method from `column`, the else clause as it stands right now will become the only case.
-
由 Gaurav Sharma 提交于
-
- 18 5月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
Minor refactoring of looping behavior for aggregation
-
- 12 9月, 2013 1 次提交
-
-
由 Rafael Mendonça França 提交于
At the point we want to add the reflection we already know the reflection is of the AggregateReflection type so we can call a specific method
-
- 24 7月, 2013 1 次提交
-
-
由 Aaron Patterson 提交于
Move model mutation to the methods that are called on the model.
-
- 23 7月, 2013 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 03 1月, 2013 1 次提交
-
-
由 Akira Matsuda 提交于
particularly, `all(options)` would warn
-
- 02 1月, 2013 1 次提交
-
-
由 Akira Matsuda 提交于
-
- 09 11月, 2012 1 次提交
-
-
由 AvnerCohen 提交于
-
- 28 7月, 2012 1 次提交
-
-
由 Rafael Mendonça França 提交于
This reverts commit 14fc8b34. Reason: we need to discuss a better path from this removal. Conflicts: activerecord/lib/active_record/reflection.rb activerecord/test/cases/base_test.rb activerecord/test/models/developer.rb
-
- 19 6月, 2012 1 次提交
-
-
由 Steve Klabnik 提交于
This feature adds a lot of complication to ActiveRecord for dubious value. Let's talk about what it does currently: class Customer < ActiveRecord::Base composed_of :balance, :class_name => "Money", :mapping => %w(balance amount) end Instead, you can do something like this: def balance @balance ||= Money.new(value, currency) end def balance=(balance) self[:value] = balance.value self[:currency] = balance.currency @balance = balance end Since that's fairly easy code to write, and doesn't need anything extra from the framework, if you use composed_of today, you'll have to add accessors/mutators like that. Closes #1436 Closes #2084 Closes #3807
-
- 24 5月, 2012 1 次提交
-
- 22 5月, 2012 1 次提交
-
-
由 Carlos Antonio da Silva 提交于
Only constantize class_name once.
-
- 20 5月, 2012 3 次提交
-
-
由 Henrik Hodne 提交于
For future reference, this is the regex I used: ^\s*#\s*\n(?!\s*#). Replace with the first match, and voilà! Note that the regex matches a little bit too much, so you probably want to `git add -i .` and go through every single diff to check if it actually should be changed.
-
由 Oscar Del Ben 提交于
-
由 Oscar Del Ben 提交于
-
- 11 5月, 2012 1 次提交
-
-
由 Hrvoje Šimić 提交于
-
- 03 5月, 2012 1 次提交
-
-
由 Yves Senn 提交于
This makes it possible to filter invalid input values before they are passed into the value-object (like empty strings). This behaviour is only relevant if the :allow_nil options is set to true. Otherwise you will get the resulting NoMethodError.
-
- 02 5月, 2012 3 次提交
-
-
由 Edward Tsech 提交于
-
由 Edward Tsech 提交于
-
由 Hrvoje Šimić 提交于
-
- 25 2月, 2012 1 次提交
-
-
由 Noah Hendrix 提交于
Fixed typo in composed_of example with Money#<=>, was comparing amount itself instead of other_money.amount
-
- 23 10月, 2011 1 次提交
-
-
由 Vijay Dev 提交于
-
- 24 5月, 2011 1 次提交
-
-
由 Sebastian Martinez 提交于
-
- 19 1月, 2011 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 08 1月, 2011 4 次提交
-
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
- 09 11月, 2010 1 次提交
-
-
由 David Chelimsky 提交于
- persisted? is the API defined in ActiveModel - makes it easier for extension libraries to conform to ActiveModel APIs without concern for whether the extended object is specifically ActiveRecord [#5927 state:committed] Signed-off-by: NSantiago Pastorino <santiago@wyeworks.com>
-