diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-16 01:42:01 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-16 01:42:01 +0530 |
commit | 3da29f647bad5e79c90721ac23658940abddd27c (patch) | |
tree | 2be782fbf903a12a37f5fe2ffa0a669727137338 /activerecord/lib/active_record/relation.rb | |
parent | 3eaf525213ccef5c63c9e296fa643ad416a3f84c (diff) | |
download | rails-3da29f647bad5e79c90721ac23658940abddd27c.tar.gz rails-3da29f647bad5e79c90721ac23658940abddd27c.tar.bz2 rails-3da29f647bad5e79c90721ac23658940abddd27c.zip |
Remove AR#scope() method
Diffstat (limited to 'activerecord/lib/active_record/relation.rb')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 8a86d2e60a..85bf878416 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -142,6 +142,15 @@ module ActiveRecord @to_sql ||= arel.to_sql end + def scope_for_create + @scope_for_create ||= begin + @create_with_value || wheres.inject({}) do |hash, where| + hash[where.operand1.name] = where.operand2.value if where.is_a?(Arel::Predicates::Equality) + hash + end + end + end + protected def method_missing(method, *args, &block) @@ -167,15 +176,6 @@ module ActiveRecord @klass.send(:with_scope, :create => scope_for_create, :find => {}) { yield } end - def scope_for_create - @scope_for_create ||= begin - @create_with_value || wheres.inject({}) do |hash, where| - hash[where.operand1.name] = where.operand2.value if where.is_a?(Arel::Predicates::Equality) - hash - end - end - end - def where_clause(join_string = " AND ") arel.send(:where_clauses).join(join_string) end |