aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-03-07 11:45:07 +0000
committerPratik Naik <pratiknaik@gmail.com>2008-03-07 11:45:07 +0000
commite1173500379ab35734ac9101e58d6eff6552ef6e (patch)
tree215fc1abeb3e005f6dbc01f4d639c18f43883f16 /activerecord/test/cases
parent8a351648ab613d42bbbf44586cff8cdeccd181d4 (diff)
downloadrails-e1173500379ab35734ac9101e58d6eff6552ef6e.tar.gz
rails-e1173500379ab35734ac9101e58d6eff6552ef6e.tar.bz2
rails-e1173500379ab35734ac9101e58d6eff6552ef6e.zip
Add :readonly option to HasManyThrough associations. Closes #11156 [miloops]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8989 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/cases')
-rwxr-xr-xactiverecord/test/cases/associations_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb
index 89b978ad06..50643066b9 100755
--- a/activerecord/test/cases/associations_test.rb
+++ b/activerecord/test/cases/associations_test.rb
@@ -554,6 +554,11 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
companies(:first_firm).readonly_clients.find(:all).each { |c| assert c.readonly? }
end
+ def test_cant_save_has_many_readonly_association
+ authors(:david).readonly_comments.each { |c| assert_raise(ActiveRecord::ReadOnlyRecord) { c.save! } }
+ authors(:david).readonly_comments.each { |c| assert c.readonly? }
+ end
+
def test_triple_equality
assert !(Array === Firm.find(:first).clients)
assert Firm.find(:first).clients === Array