diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-25 12:37:08 -0500 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-25 12:37:08 -0500 |
commit | ccdeb43d2e06fb87c1fb84e979c4f7775e7ed105 (patch) | |
tree | 6a811e866879cb79f0db9e4a9aaf7c6b6c2989e5 /activerecord/lib/active_record/associations | |
parent | b395265f7c9fbb94a29d0934dd329690a02861df (diff) | |
parent | 7fe5ae8d237c8f821bc5e984f98d9d7eb7c35266 (diff) | |
download | rails-ccdeb43d2e06fb87c1fb84e979c4f7775e7ed105.tar.gz rails-ccdeb43d2e06fb87c1fb84e979c4f7775e7ed105.tar.bz2 rails-ccdeb43d2e06fb87c1fb84e979c4f7775e7ed105.zip |
Merge branch 'master' into adequaterecord
* master: (28 commits)
move AR length validation tests into separate test-case.
No need for trailing slash on migration path.
reset `@arel` when modifying a Relation in place.
PostgreSQL Timestamps always map to `:datetime`.
[ci skip] Improve formatting and yml
Fix a typo in the doc of forty_two AR FinderMethod
Improve readability of contributing to rails guide. [ci skip]
Precompile the image we're referencing, too.
`ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions.
Fixed an issue with migrating legacy json cookies.
Correct comment [ci skip]
Perfer to define methods instead of calling test
Fix syntax error
Add CHANGELOG entry for #14757 [ci skip]
Fix run-on sentences and improve grammar [skip ci]
Add test for using ActionView::Helpers::FormHelper.label with block and html
select! renamed to avoid name collision Array#select!
Rearrange deck chairs on the titanic. Organize connection handling test cases.
Change favicon_link_tag helper mimetype from image/vnd.microsoft.icon to image/x-icon.
ActionController::Renderers documentation fix
...
Diffstat (limited to 'activerecord/lib/active_record/associations')
3 files changed, 6 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb index 83c69586e6..bf461070e0 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -119,7 +119,7 @@ module ActiveRecord scope.references_values = Array(values[:references]) + Array(preload_values[:references]) scope.bind_values = (reflection_binds + preload_binds) - scope.select! preload_values[:select] || values[:select] || table[Arel.star] + scope._select! preload_values[:select] || values[:select] || table[Arel.star] scope.includes! preload_values[:includes] || values[:includes] if preload_values.key? :order diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb index 70e97432e4..1fed7f74e7 100644 --- a/activerecord/lib/active_record/associations/preloader/through_association.rb +++ b/activerecord/lib/active_record/associations/preloader/through_association.rb @@ -84,7 +84,7 @@ module ActiveRecord end scope.references! reflection_scope.values[:references] - scope.order! reflection_scope.values[:order] if scope.eager_loading? + scope = scope.order reflection_scope.values[:order] if scope.eager_loading? end scope diff --git a/activerecord/lib/active_record/associations/through_association.rb b/activerecord/lib/active_record/associations/through_association.rb index ba7d2a3782..f8a85b8a6f 100644 --- a/activerecord/lib/active_record/associations/through_association.rb +++ b/activerecord/lib/active_record/associations/through_association.rb @@ -14,9 +14,11 @@ module ActiveRecord def target_scope scope = super chain.drop(1).each do |reflection| + relation = reflection.klass.all + relation.merge!(reflection.scope) if reflection.scope + scope.merge!( - reflection.klass.all. - except(:select, :create_with, :includes, :preload, :joins, :eager_load) + relation.except(:select, :create_with, :includes, :preload, :joins, :eager_load) ) end scope |