aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-20 18:40:19 +0530
committerPratik Naik <pratiknaik@gmail.com>2010-01-20 19:01:26 +0530
commit8b9bfbe225a59ccefa46f1e8bf301bc483bef0e0 (patch)
tree023c1c237bf65da35ebaccc3db843587b1052e69 /activerecord
parentf216fadc0e4a54d1807fe5a9462f7bd34e9024b0 (diff)
downloadrails-8b9bfbe225a59ccefa46f1e8bf301bc483bef0e0.tar.gz
rails-8b9bfbe225a59ccefa46f1e8bf301bc483bef0e0.tar.bz2
rails-8b9bfbe225a59ccefa46f1e8bf301bc483bef0e0.zip
Dont delegate Relation#update to arel
Diffstat (limited to 'activerecord')
-rwxr-xr-xactiverecord/lib/active_record/base.rb4
-rw-r--r--activerecord/lib/active_record/locking/optimistic.rb2
-rw-r--r--activerecord/lib/active_record/relation.rb2
3 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 1896b49977..45edc3fe60 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -685,7 +685,7 @@ module ActiveRecord #:nodoc:
relation = current_scoped_methods.except(:limit, :order).merge(relation) if current_scoped_methods
end
- relation.update(sanitize_sql_for_assignment(updates))
+ relation.arel.update(sanitize_sql_for_assignment(updates))
end
# Returns the result of an SQL statement that should only include a COUNT(*) in the SELECT part.
@@ -2188,7 +2188,7 @@ module ActiveRecord #:nodoc:
def update(attribute_names = @attributes.keys)
attributes_with_values = arel_attributes_values(false, false, attribute_names)
return 0 if attributes_with_values.empty?
- self.class.unscoped.where(self.class.arel_table[self.class.primary_key].eq(id)).update(attributes_with_values)
+ self.class.unscoped.where(self.class.arel_table[self.class.primary_key].eq(id)).arel.update(attributes_with_values)
end
# Creates a record with values matching those of the instance attributes
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb
index bf0683eb8f..9044ca418b 100644
--- a/activerecord/lib/active_record/locking/optimistic.rb
+++ b/activerecord/lib/active_record/locking/optimistic.rb
@@ -84,7 +84,7 @@ module ActiveRecord
relation.table[self.class.primary_key].eq(quoted_id).and(
relation.table[self.class.locking_column].eq(quote_value(previous_value))
)
- ).update(arel_attributes_values(false, false, attribute_names))
+ ).arel.update(arel_attributes_values(false, false, attribute_names))
unless affected_rows == 1
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb
index a6c283e03c..a7750f60b4 100644
--- a/activerecord/lib/active_record/relation.rb
+++ b/activerecord/lib/active_record/relation.rb
@@ -8,7 +8,7 @@ module ActiveRecord
include FinderMethods, Calculations, SpawnMethods, QueryMethods
delegate :length, :collect, :map, :each, :all?, :include?, :to => :to_a
- delegate :insert, :update, :to => :arel
+ delegate :insert, :to => :arel
attr_reader :table, :klass