diff options
author | Tan Huynh <danhuynhdev@gmail.com> | 2018-03-20 13:02:23 +0700 |
---|---|---|
committer | Tan Huynh <danhuynhdev@gmail.com> | 2018-03-23 08:01:46 +0700 |
commit | 3f297be72b0a774d07cea3aa243f81cdbd6db2a3 (patch) | |
tree | 354ac6804301119667ea3705c56f627ff517f96a /activerecord/test/models/admin | |
parent | 57e145387ba57602afb0907f2a3897d37089dc4e (diff) | |
download | rails-3f297be72b0a774d07cea3aa243f81cdbd6db2a3.tar.gz rails-3f297be72b0a774d07cea3aa243f81cdbd6db2a3.tar.bz2 rails-3f297be72b0a774d07cea3aa243f81cdbd6db2a3.zip |
Add custom prefix to ActiveRecord::Store accessors
Add a prefix option to ActiveRecord::Store.store_accessor and
ActiveRecord::Store.store. This option allows stores to have identical keys
with different accessors.
Diffstat (limited to 'activerecord/test/models/admin')
-rw-r--r-- | activerecord/test/models/admin/user.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/test/models/admin/user.rb b/activerecord/test/models/admin/user.rb index abb5cb28e7..3f55364510 100644 --- a/activerecord/test/models/admin/user.rb +++ b/activerecord/test/models/admin/user.rb @@ -19,6 +19,9 @@ class Admin::User < ActiveRecord::Base store :params, accessors: [ :token ], coder: YAML store :settings, accessors: [ :color, :homepage ] store_accessor :settings, :favorite_food + store :parent, accessors: [:birthday, :name], prefix: true + store :spouse, accessors: [:birthday], prefix: :partner + store_accessor :spouse, :name, prefix: :partner store :preferences, accessors: [ :remember_login ] store :json_data, accessors: [ :height, :weight ], coder: Coder.new store :json_data_empty, accessors: [ :is_a_good_guy ], coder: Coder.new |