diff options
author | Jeremy Walker <jeremy@meducation.net> | 2012-02-02 18:57:15 +0000 |
---|---|---|
committer | Jeremy Walker <jeremy@meducation.net> | 2012-02-02 18:57:15 +0000 |
commit | 58d10e2012c414cc262b4b4f3305c3c4e0dbf048 (patch) | |
tree | 260b826f75ced6f922360d25ae6d77d33f8745e1 /activerecord/lib/active_record | |
parent | 56ba2103c89c8ee12ecc8995f759c459796fa328 (diff) | |
download | rails-58d10e2012c414cc262b4b4f3305c3c4e0dbf048.tar.gz rails-58d10e2012c414cc262b4b4f3305c3c4e0dbf048.tar.bz2 rails-58d10e2012c414cc262b4b4f3305c3c4e0dbf048.zip |
Allow store to be a not null column.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/store.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/store.rb b/activerecord/lib/active_record/store.rb index 8cc84f81d0..49d01de365 100644 --- a/activerecord/lib/active_record/store.rb +++ b/activerecord/lib/active_record/store.rb @@ -36,11 +36,13 @@ module ActiveRecord def store_accessor(store_attribute, *keys) Array(keys).flatten.each do |key| define_method("#{key}=") do |value| + send("#{store_attribute}=", {}) unless send(store_attribute).is_a?(Hash) send(store_attribute)[key] = value send("#{store_attribute}_will_change!") end define_method(key) do + send("#{store_attribute}=", {}) unless send(store_attribute).is_a?(Hash) send(store_attribute)[key] end end |