diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-06-24 13:17:24 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2010-06-24 13:17:24 -0300 |
commit | 4b5f417e63e4cdd7fd6837c10ebaa9dd4860f55e (patch) | |
tree | 02935917f435a9af438934f356613117d4c928c6 | |
parent | 2c203a94136d5b8681e2b2b55783ef6dde54405f (diff) | |
download | rails-4b5f417e63e4cdd7fd6837c10ebaa9dd4860f55e.tar.gz rails-4b5f417e63e4cdd7fd6837c10ebaa9dd4860f55e.tar.bz2 rails-4b5f417e63e4cdd7fd6837c10ebaa9dd4860f55e.zip |
Only yield block if given.
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 43032ba9d8..e8d0f215f6 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -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? } |