aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index 45ceb1e3ad..f991a3076e 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -479,15 +479,15 @@ module ActiveRecord
verify_readonly_attribute(key.to_s)
end
+ attributes.each do |k, v|
+ write_attribute_without_type_cast(k, v)
+ end
+
affected_rows = self.class._update_record(
attributes,
self.class.primary_key => id_in_database
)
- attributes.each do |k, v|
- write_attribute_without_type_cast(k, v)
- end
-
affected_rows == 1
end