From 3da29f647bad5e79c90721ac23658940abddd27c Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sat, 16 Jan 2010 01:42:01 +0530 Subject: Remove AR#scope() method --- activerecord/lib/active_record/relation.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'activerecord/lib/active_record/relation.rb') 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 -- cgit v1.2.3