diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-11 11:43:27 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-11 11:44:08 -0700 |
commit | 0f502ab88fb9a9be10ed7c28f649505651ecf96e (patch) | |
tree | 222d08e4d4f8d1c9da7e3e8baf0ecb5a55e5dea6 /activerecord/lib/active_record | |
parent | 2b8f24998ebafe7257d50aa5ae90fa1a8ae5860f (diff) | |
download | rails-0f502ab88fb9a9be10ed7c28f649505651ecf96e.tar.gz rails-0f502ab88fb9a9be10ed7c28f649505651ecf96e.tar.bz2 rails-0f502ab88fb9a9be10ed7c28f649505651ecf96e.zip |
avoiding tap saves us time
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 7bf1d81ea2..0ea662f310 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -49,7 +49,9 @@ module ActiveRecord def where(opts, *rest) value = build_where(opts, rest) - value ? clone.tap {|r| r.where_values += Array.wrap(value) } : clone + copy = clone + copy.where_values += Array.wrap(value) if value + copy end def having(*args) @@ -58,7 +60,9 @@ module ActiveRecord end def limit(value = true) - clone.tap {|r| r.limit_value = value } + copy = clone + copy.limit_value = value + copy end def offset(value = true) |