From 757f7231cccd2bcbfb83fba5cb203fb320f3e613 Mon Sep 17 00:00:00 2001 From: Joost Baaij Date: Tue, 13 Mar 2012 16:14:20 +0100 Subject: Remember the stored attributes in a config attribute. This allows you to retrieve the list of attributes you've defined. Usable for e.g. selects in the view, or interators based on the attributes you wish to store in the serialized column. --- activerecord/test/cases/store_test.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/store_test.rb b/activerecord/test/cases/store_test.rb index 79476ed2a4..e401dd4b12 100644 --- a/activerecord/test/cases/store_test.rb +++ b/activerecord/test/cases/store_test.rb @@ -13,7 +13,7 @@ class StoreTest < ActiveRecord::TestCase assert_equal 'black', @john.color assert_nil @john.homepage end - + test "writing store attributes through accessors" do @john.color = 'red' @john.homepage = '37signals.com' @@ -111,4 +111,8 @@ class StoreTest < ActiveRecord::TestCase @john.is_a_good_guy = false assert_equal false, @john.is_a_good_guy end + + test "stored attributes are returned" do + assert_equal [:color, :homepage], Admin::User.stored_attributes[:settings] + end end -- cgit v1.2.3