Permalink
Browse files

avoiding tap saves us time

  • Loading branch information...
1 parent dac2b37 commit a56ee4c9a23ca4f41ea001810a7c2358cc043f1d @tenderlove tenderlove committed Aug 11, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 activerecord/lib/active_record/relation/query_methods.rb
@@ -49,7 +49,9 @@ def joins(*args)
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 @@ def having(*args)
end
def limit(value = true)
- clone.tap {|r| r.limit_value = value }
+ copy = clone
+ copy.limit_value = value
+ copy
end
def offset(value = true)

0 comments on commit a56ee4c

Please sign in to comment.