| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
| |
It doesn't serve much purpose now that ActiveRecord::Base.all returns a
Relation.
The code is moved to active_record_deprecated_finders.
|
| |
|
|
|
|
| |
things
|
|
|
|
| |
(as described in #5667)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
the scope class method. Just define a class method yourself instead."
This reverts commit f0e198bfa1e3f9689e0cde1d194a44027fc90b3c.
Conflicts:
activerecord/test/models/post.rb
|
|
|
|
| |
class method. Just define a class method yourself instead.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| | |
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
|
| |
| |
| |
| | |
removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences.
|
| |
| |
| |
| | |
was previously untested
|
| |
| |
| |
| | |
Foo.joins(:bar) will work for through associations. There is some duplicated code now, which will be refactored.
|
|/
|
|
| |
including adding some explanatory comments, but more importantly structures it in such a way as to allow a JoinAssociation to produce an arbitrary number of actual joins, which will be necessary for nested has many through support. Also added 3 tests covering functionality which existed but was not previously covered.
|
| |
|
| |
|
|
|
|
| |
state:resolved]
|
|
|
|
| |
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
|
|
| |
#10804 [jeanmartin]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8735 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|