mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Only yield block if given.
This commit is contained in:
@@ -22,9 +22,9 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
class_eval <<-CEVAL, __FILE__, __LINE__ + 1
|
||||
def select(*args, &block)
|
||||
def select(*args)
|
||||
if block_given?
|
||||
to_a.select(&block)
|
||||
to_a.select { |*block_args| yield(*block_args) }
|
||||
else
|
||||
new_relation = clone
|
||||
value = Array.wrap(args.flatten).reject {|x| x.blank? }
|
||||
|
||||
Reference in New Issue
Block a user