diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index befc5c9999e26de02b158af93a40251f8d3bd9d8..e53d688ad9bcbe761902d52a8c4a528817fca0aa 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,4 +1,5 @@ ## Rails 4.0.0 (unreleased) ## + * Added custom coders support for ActiveRecord::Store. Now you can set your custom coder like this: diff --git a/activerecord/lib/active_record/store.rb b/activerecord/lib/active_record/store.rb index a67d6a22881ae6f6a4eb32812bdec3e81e243f19..ce2ea85ef971530071bb4590e5a842cf81dcd4db 100644 --- a/activerecord/lib/active_record/store.rb +++ b/activerecord/lib/active_record/store.rb @@ -13,6 +13,9 @@ module ActiveRecord # You can set custom coder to encode/decode your serialized attributes to/from different formats. # JSON, YAML, Marshal are supported out of the box. Generally it can be any wrapper that provides +load+ and +dump+. # + # String keys should be used for direct access to virtual attributes because of most of the coders do not + # distinguish symbols and strings as keys. + # # Examples: # # class User < ActiveRecord::Base @@ -20,10 +23,8 @@ module ActiveRecord # end # # u = User.new(color: 'black', homepage: '37signals.com') - # u.color # Accessor stored attribute + # u.color # Accessor stored attribute # u.settings['country'] = 'Denmark' # Any attribute, even if not specified with an accessor - # String keys should be used for direct access to virtual attributes because of most of the coders do not - # distinguish symbols and strings as keys. # # # Add additional accessors to an existing store through store_accessor # class SuperUser < User