aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorJoost Baaij <joost@spacebabies.nl>2012-03-13 16:14:20 +0100
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-06-18 23:49:48 -0300
commit757f7231cccd2bcbfb83fba5cb203fb320f3e613 (patch)
treebd16dbccdaa0d54e2ad579c626c5a3ea5afbd49b /activerecord/test/cases
parentdf2104e06784a4b98d8f30cb3ea4eee69304e768 (diff)
downloadrails-757f7231cccd2bcbfb83fba5cb203fb320f3e613.tar.gz
rails-757f7231cccd2bcbfb83fba5cb203fb320f3e613.tar.bz2
rails-757f7231cccd2bcbfb83fba5cb203fb320f3e613.zip
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.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/store_test.rb6
1 files changed, 5 insertions, 1 deletions
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