diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-05-21 09:01:36 -0300 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-05-21 09:01:36 -0300 |
commit | 91421984b7182a483db0f96239e2d5f27ea3a9de (patch) | |
tree | 782cb2cca41df9ebea3d3bcefea464b8ece8ef6f /activerecord/lib/active_record/internal_metadata.rb | |
parent | db312a9fb04097e7d584d24dd446aac7dea7e11f (diff) | |
parent | cfa1df4b07bee5b2bbcbf9edd2ac287b4fb23c18 (diff) | |
download | rails-91421984b7182a483db0f96239e2d5f27ea3a9de.tar.gz rails-91421984b7182a483db0f96239e2d5f27ea3a9de.tar.bz2 rails-91421984b7182a483db0f96239e2d5f27ea3a9de.zip |
Merge pull request #24732 from y-yagi/update_record_specified_in_the_key
update record specified in key
Diffstat (limited to 'activerecord/lib/active_record/internal_metadata.rb')
-rw-r--r-- | activerecord/lib/active_record/internal_metadata.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/internal_metadata.rb b/activerecord/lib/active_record/internal_metadata.rb index 81db96bffd..17a5dc1d1b 100644 --- a/activerecord/lib/active_record/internal_metadata.rb +++ b/activerecord/lib/active_record/internal_metadata.rb @@ -19,7 +19,7 @@ module ActiveRecord end def []=(key, value) - first_or_initialize(key: key).update_attributes!(value: value) + find_or_initialize_by(key: key).update_attributes!(value: value) end def [](key) |