aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorkuahyeow <kuahyeow@gmail.com>2012-03-07 22:54:46 +1300
committerMichael Koziarski <michael@koziarski.com>2012-03-08 09:48:59 +1300
commita149612c0b10bc71c98854aa07b0371bf7d8ac70 (patch)
tree228a0b815ef3db76ee34e263b761486112ef2f54 /activerecord
parent89cef0757aee00e2b7dc742f155a18c82e3fa915 (diff)
downloadrails-a149612c0b10bc71c98854aa07b0371bf7d8ac70.tar.gz
rails-a149612c0b10bc71c98854aa07b0371bf7d8ac70.tar.bz2
rails-a149612c0b10bc71c98854aa07b0371bf7d8ac70.zip
Add tests to test that through associations are not readonly, and we can update the records we retrive from the association
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb
index 9cc09194dc..12cae934b6 100644
--- a/activerecord/test/cases/associations/has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -688,6 +688,17 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
assert author.comments.include?(comment)
end
+ def test_through_association_readonly_should_be_false
+ assert !people(:michael).posts.first.readonly?
+ assert !people(:michael).posts.all.first.readonly?
+ end
+
+ def test_can_update_through_association
+ assert_nothing_raised do
+ people(:michael).posts.first.update_attributes!(:title => "Can write")
+ end
+ end
+
def test_has_many_through_polymorphic_with_primary_key_option
assert_equal [categories(:general)], authors(:david).essay_categories