aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/reference.rb
Commit message (Collapse)AuthorAgeFilesLines
* Initialize accessors to remove some warnings in Ruby 2.0Carlos Antonio da Silva2012-11-191-3/+2
|
* Deprecate eager-evaluated scopes.Jon Leighton2012-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use this: scope :red, where(color: 'red') default_scope where(color: 'red') Use this: scope :red, -> { where(color: 'red') } default_scope { where(color: 'red') } The former has numerous issues. It is a common newbie gotcha to do the following: scope :recent, where(published_at: Time.now - 2.weeks) Or a more subtle variant: scope :recent, -> { where(published_at: Time.now - 2.weeks) } scope :recent_red, recent.where(color: 'red') Eager scopes are also very complex to implement within Active Record, and there are still bugs. For example, the following does not do what you expect: scope :remove_conditions, except(:where) where(...).remove_conditions # => still has conditions
* Un-deprecate using 'default_scope' as a macro, but if you are calling the ↵Jon Leighton2011-04-181-4/+1
| | | | macro multiple times that will give deprecation warnings, and in 3.2 we will simply overwrite the default scope when you call the macro multiple times.
* Deprecated support for passing hashes and relations to default_scope, in ↵Jon Leighton2011-04-121-2/+5
| | | | favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details.
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-0/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/class_methods/join_dependency.rb activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb activerecord/lib/active_record/associations/has_many_association.rb activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/lib/active_record/associations/has_one_association.rb activerecord/lib/active_record/associations/has_one_through_association.rb activerecord/lib/active_record/associations/through_association_scope.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/associations/has_many_through_associations_test.rb activerecord/test/cases/associations/has_one_through_associations_test.rb activerecord/test/cases/reflection_test.rb activerecord/test/cases/relations_test.rb activerecord/test/fixtures/memberships.yml activerecord/test/models/categorization.rb activerecord/test/models/category.rb activerecord/test/models/member.rb activerecord/test/models/reference.rb activerecord/test/models/tagging.rb
| * Support the :dependent option on has_many :through associations. For ↵Jon Leighton2011-02-071-0/+12
| | | | | | | | historical and practical reasons, :delete_all is the default deletion strategy employed by association.delete(*records), despite the fact that the default strategy is :nullify for regular has_many. Also, this only works at all if the source reflection is a belongs_to. For other situations, you should directly modify the through association.
* | Fix naughty trailing whitespaceJon Leighton2010-10-311-1/+1
| |
* | Add support for nested through associations in JoinAssociation. Hence ↵Jon Leighton2010-10-091-0/+2
|/ | | | Foo.joins(:bar) will work for through associations. There is some duplicated code now, which will be refactored.
* eagerly loaded association records should respect default_scope [#2931 ↵Subba Rao Pasupuleti2010-07-211-0/+5
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Ensure table names are quoted by the association preloading code.Frederick Cheung2008-04-261-0/+4
[#45 state:resolved] Signed-off-by: Michael Koziarski <michael@koziarski.com>