diff options
author | José Valim <jose.valim@gmail.com> | 2010-06-24 20:19:19 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-24 20:19:19 +0200 |
commit | 73682d016c2fff0b92ddb950efb25e80b07c716f (patch) | |
tree | fdeede2d9216fcb5bdd67246e426114974422f12 /activerecord/lib/active_record/relation | |
parent | 67ee6c38b9b112eabe37d5869c23210b9ebf453c (diff) | |
parent | 4b5f417e63e4cdd7fd6837c10ebaa9dd4860f55e (diff) | |
download | rails-73682d016c2fff0b92ddb950efb25e80b07c716f.tar.gz rails-73682d016c2fff0b92ddb950efb25e80b07c716f.tar.bz2 rails-73682d016c2fff0b92ddb950efb25e80b07c716f.zip |
Merge remote branch 'miloops/fixes'
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 7a0c9dc612..f39951e16c 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -87,8 +87,8 @@ module ActiveRecord # person.visits += 1 # person.save! # end - def find(*args, &block) - return to_a.find(&block) if block_given? + def find(*args) + return to_a.find { |*block_args| yield(*block_args) } if block_given? options = args.extract_options! @@ -259,8 +259,8 @@ module ActiveRecord record end - def find_with_ids(*ids, &block) - return to_a.find(&block) if block_given? + def find_with_ids(*ids) + return to_a.find { |*block_args| yield(*block_args) } if block_given? expects_array = ids.first.kind_of?(Array) return ids.first if expects_array && ids.first.empty? 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? } |