From d1545bcf94af287fca1fc34e0f9c7cfda56ff130 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 8 Jul 2011 12:16:32 +0900 Subject: fix AR having() not to raise NoMethodError when the given argument does not respond to empty? having raises NoMethodError: undefined method `empty?' when a Fixnum or Date/Time were passed via varargs --- activerecord/lib/active_record/relation/query_methods.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index d17861f407..8bd4732c0c 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -96,11 +96,11 @@ module ActiveRecord relation end - def having(*args) - return self if args.blank? + def having(opts, *rest) + return self if opts.blank? relation = clone - relation.having_values += build_where(*args) + relation.having_values += build_where(opts, rest) relation end -- cgit v1.2.3