diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-01-06 05:43:14 -0800 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-01-06 05:43:14 -0800 |
commit | f2b80a41b5c163b32dfdd0fa797466543c6ec0e9 (patch) | |
tree | 5bdab91c538ddd338c7e4b72699f84398409abbd /activerecord/test | |
parent | 2d1d426c675b35bc34a25c5a5960a7f0a75c520b (diff) | |
parent | 901a0c8b4a3b1de8ff1ec8feb4b67f727c07dc8b (diff) | |
download | rails-f2b80a41b5c163b32dfdd0fa797466543c6ec0e9.tar.gz rails-f2b80a41b5c163b32dfdd0fa797466543c6ec0e9.tar.bz2 rails-f2b80a41b5c163b32dfdd0fa797466543c6ec0e9.zip |
Merge pull request #13593 from oliveiraethales/store_yaml_coder
Fix: ActiveRecord::Store TypeError conversion when using YAML coder
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/store_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/models/admin/user.rb | 1 | ||||
-rw-r--r-- | activerecord/test/schema/schema.rb | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/store_test.rb b/activerecord/test/cases/store_test.rb index 0c9f7ccd55..6f632b4d8d 100644 --- a/activerecord/test/cases/store_test.rb +++ b/activerecord/test/cases/store_test.rb @@ -162,4 +162,8 @@ class StoreTest < ActiveRecord::TestCase assert_equal [:color], first_model.stored_attributes[:data] assert_equal [:width, :height], second_model.stored_attributes[:data] end + + test "YAML coder initializes the store when a Nil value is given" do + assert_equal({}, @john.params) + end end diff --git a/activerecord/test/models/admin/user.rb b/activerecord/test/models/admin/user.rb index 4c3b71e8f9..9a80aaba01 100644 --- a/activerecord/test/models/admin/user.rb +++ b/activerecord/test/models/admin/user.rb @@ -14,6 +14,7 @@ class Admin::User < ActiveRecord::Base end belongs_to :account + store :params, accessors: [ :color ], coder: YAML store :settings, :accessors => [ :color, :homepage ] store_accessor :settings, :favorite_food store :preferences, :accessors => [ :remember_login ] diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index ac546fc296..ddfc1ac0d6 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -45,6 +45,7 @@ ActiveRecord::Schema.define do t.string :preferences, null: true, default: '', limit: 1024 t.string :json_data, null: true, limit: 1024 t.string :json_data_empty, null: true, default: "", limit: 1024 + t.text :params t.references :account end |