aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-01-14 12:01:57 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2014-01-14 12:01:57 -0800
commitf5a635e4f47f5c864d49e8fe23641d65adfb25e3 (patch)
tree0b17be75c5de8b0e22bfa3ec6479e3d2e9c77de3 /activerecord/lib/active_record
parentb5f679b51ad3d8bdc249d231752c83ddc4d83ac8 (diff)
downloadrails-f5a635e4f47f5c864d49e8fe23641d65adfb25e3.tar.gz
rails-f5a635e4f47f5c864d49e8fe23641d65adfb25e3.tar.bz2
rails-f5a635e4f47f5c864d49e8fe23641d65adfb25e3.zip
where needs to bring the bind params when creating a new relation
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/relation/spawn_methods.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb
index 2552cbd234..57d66bce4b 100644
--- a/activerecord/lib/active_record/relation/spawn_methods.rb
+++ b/activerecord/lib/active_record/relation/spawn_methods.rb
@@ -58,6 +58,9 @@ module ActiveRecord
# Post.order('id asc').only(:where) # discards the order condition
# Post.order('id asc').only(:where, :order) # uses the specified order
def only(*onlies)
+ if onlies.any? { |o| o == :where }
+ onlies << :bind
+ end
relation_with values.slice(*onlies)
end