diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-03-10 08:51:11 -0800 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-10 13:29:00 -0800 |
commit | aad432a9e91d991218276b5945d43e9dcb247b63 (patch) | |
tree | 8f3282265a10a1ddd37b64387af96b81d51c9408 /activerecord/lib/active_record/relation/query_methods.rb | |
parent | 4745b53bcda400cf2e8cb4f2c0bf068f6d13c0e5 (diff) | |
download | rails-aad432a9e91d991218276b5945d43e9dcb247b63.tar.gz rails-aad432a9e91d991218276b5945d43e9dcb247b63.tar.bz2 rails-aad432a9e91d991218276b5945d43e9dcb247b63.zip |
removing spawn from SpawnMethods
Signed-off-by: wycats <wycats@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, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 6c4e84a958..e00d9cdf27 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -8,7 +8,7 @@ module ActiveRecord class_eval <<-CEVAL def #{query_method}(*args) - new_relation = spawn + new_relation = clone value = Array.wrap(args.flatten).reject {|x| x.blank? } new_relation.#{query_method}_values += value if value.present? new_relation @@ -19,7 +19,7 @@ module ActiveRecord [:where, :having].each do |query_method| class_eval <<-CEVAL def #{query_method}(*args) - new_relation = spawn + new_relation = clone value = build_where(*args) new_relation.#{query_method}_values += [*value] if value.present? new_relation @@ -32,7 +32,7 @@ module ActiveRecord class_eval <<-CEVAL def #{query_method}(value = true) - new_relation = spawn + new_relation = clone new_relation.#{query_method}_value = value new_relation end @@ -41,12 +41,12 @@ module ActiveRecord end def lock(locks = true) - relation = spawn + relation = clone case locks when String, TrueClass, NilClass - spawn.tap {|new_relation| new_relation.lock_value = locks || true } + clone.tap {|new_relation| new_relation.lock_value = locks || true } else - spawn.tap {|new_relation| new_relation.lock_value = false } + clone.tap {|new_relation| new_relation.lock_value = false } end end |