From f5a635e4f47f5c864d49e8fe23641d65adfb25e3 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 14 Jan 2014 12:01:57 -0800 Subject: where needs to bring the bind params when creating a new relation --- activerecord/lib/active_record/relation/spawn_methods.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/lib/active_record') 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 -- cgit v1.2.3