diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-06-25 20:31:10 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-26 01:35:23 +0200 |
commit | 47134a04bbce216f9c31473b1a0c1a077d624692 (patch) | |
tree | 4b5c301201afea3d3cc37f5725ecc7a413c0be6a /activerecord/lib/active_record/relation/query_methods.rb | |
parent | 026cec339046c6ff4629b445d8284d7ad3da5085 (diff) | |
download | rails-47134a04bbce216f9c31473b1a0c1a077d624692.tar.gz rails-47134a04bbce216f9c31473b1a0c1a077d624692.tar.bz2 rails-47134a04bbce216f9c31473b1a0c1a077d624692.zip |
blocks removed from all the ActiveRelation query_methods, extend method added instead
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record/relation/query_methods.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index f7c4c7991b..ff5bce9d8b 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -11,9 +11,8 @@ module ActiveRecord next if [:where, :having, :select].include?(query_method) class_eval <<-CEVAL, __FILE__, __LINE__ + 1 - def #{query_method}(*args, &block) + def #{query_method}(*args) new_relation = clone - new_relation.send(:apply_modules, Module.new(&block)) if block_given? value = Array.wrap(args.flatten).reject {|x| x.blank? } new_relation.#{query_method}_values += value if value.present? new_relation @@ -21,9 +20,8 @@ module ActiveRecord CEVAL end - def reorder(*args, &block) + def reorder(*args) new_relation = clone - new_relation.send(:apply_modules, Module.new(&block)) if block_given? value = Array.wrap(args.flatten).reject {|x| x.blank? } new_relation.order_values = value if value.present? new_relation @@ -42,9 +40,8 @@ module ActiveRecord [:where, :having].each do |query_method| class_eval <<-CEVAL, __FILE__, __LINE__ + 1 - def #{query_method}(*args, &block) + def #{query_method}(*args) new_relation = clone - new_relation.send(:apply_modules, Module.new(&block)) if block_given? value = build_where(*args) new_relation.#{query_method}_values += Array.wrap(value) if value.present? new_relation @@ -56,9 +53,8 @@ module ActiveRecord attr_accessor :"#{query_method}_value" class_eval <<-CEVAL, __FILE__, __LINE__ + 1 - def #{query_method}(value = true, &block) + def #{query_method}(value = true) new_relation = clone - new_relation.send(:apply_modules, Module.new(&block)) if block_given? new_relation.#{query_method}_value = value new_relation end |