diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-07 13:05:46 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-07 13:05:46 -0300 |
commit | 287e926d564bbe8db6baad85d35276042e0dc47a (patch) | |
tree | c1a0d472da9293f40ae44662c5cefd53939e0298 /activerecord/lib | |
parent | 2f5fab8d5af6dfe59e73fcf3d8d9902715b4284b (diff) | |
parent | e1f33110e8917eab62614f3ffca4559c62e92ed7 (diff) | |
download | rails-287e926d564bbe8db6baad85d35276042e0dc47a.tar.gz rails-287e926d564bbe8db6baad85d35276042e0dc47a.tar.bz2 rails-287e926d564bbe8db6baad85d35276042e0dc47a.zip |
Merge pull request #15563 from sgrif/sg-raw-attributes-access
Remove duplicated `@raw_attributes.keys`
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 7fb27ef6e9..f7ceff7469 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -66,7 +66,7 @@ module ActiveRecord send(lock_col + '=', previous_lock_value + 1) end - def _update_record(attribute_names = @raw_attributes.keys) #:nodoc: + def _update_record(attribute_names = self.attribute_names) #:nodoc: return super unless locking_enabled? return 0 if attribute_names.empty? diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index f1f0d3e57f..525289c270 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -494,7 +494,7 @@ module ActiveRecord # Updates the associated record with values matching those of the instance attributes. # Returns the number of affected rows. - def _update_record(attribute_names = @raw_attributes.keys) + def _update_record(attribute_names = self.attribute_names) attributes_values = arel_attributes_with_values_for_update(attribute_names) if attributes_values.empty? 0 @@ -505,7 +505,7 @@ module ActiveRecord # Creates a record with values matching those of the instance attributes # and returns its id. - def _create_record(attribute_names = @raw_attributes.keys) + def _create_record(attribute_names = self.attribute_names) attributes_values = arel_attributes_with_values_for_create(attribute_names) new_id = self.class.unscoped.insert attributes_values |