Skip to content

Commit

Permalink
avoiding tap saves us time
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Aug 11, 2010
1 parent 2b8f249 commit 0f502ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions activerecord/lib/active_record/relation/query_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 0f502ab

Please sign in to comment.