From 1a4d13b8f429afe218eb98d8dbf82780e4f191e6 Mon Sep 17 00:00:00 2001 From: Sergey Alekseev Date: Fri, 23 May 2014 23:42:36 +0300 Subject: Remove duplicated parameter check on #where! It seems that #where! is not designed to be used as a chained where. See initial implementation at 8c2c60511beaad05a218e73c4918ab89fb1804f0. So, no need to check twice. We should not test #where! https://github.com/rails/rails/pull/15285#discussion_r13018316 --- activerecord/lib/active_record/relation/query_methods.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'activerecord/lib/active_record/relation/query_methods.rb') diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index a607e9ac87..1262b2c291 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -573,15 +573,11 @@ WARNING end end - def where!(opts = :chain, *rest) # :nodoc: - if opts == :chain - WhereChain.new(self) - else - references!(PredicateBuilder.references(opts)) if Hash === opts + def where!(opts, *rest) # :nodoc: + references!(PredicateBuilder.references(opts)) if Hash === opts - self.where_values += build_where(opts, rest) - self - end + self.where_values += build_where(opts, rest) + self end # Allows you to change a previously set where condition for a given attribute, instead of appending to that condition. -- cgit v1.2.3