aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_test.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-03-13 09:45:09 +0000
committerMichael Koziarski <michael@koziarski.com>2007-03-13 09:45:09 +0000
commit5bd116ccf4e341b25dbba418b6c5f0ed3b0c5187 (patch)
tree580463b18d98f9992194601d59975a5687bb31a5 /activerecord/test/associations_test.rb
parentf770165cc23a44ac329b5b1fbd47376a6c2e3f11 (diff)
downloadrails-5bd116ccf4e341b25dbba418b6c5f0ed3b0c5187.tar.gz
rails-5bd116ccf4e341b25dbba418b6c5f0ed3b0c5187.tar.bz2
rails-5bd116ccf4e341b25dbba418b6c5f0ed3b0c5187.zip
Make sure with_scope takes both :select and :joins into account when setting :readonly. Allows you to save records you retrieve using finders on a has_many :through associations. [Koz]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6413 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_test.rb')
-rwxr-xr-xactiverecord/test/associations_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb
index db4e4118f4..250fa1027c 100755
--- a/activerecord/test/associations_test.rb
+++ b/activerecord/test/associations_test.rb
@@ -10,6 +10,8 @@ require 'fixtures/order'
require 'fixtures/category'
require 'fixtures/post'
require 'fixtures/author'
+require 'fixtures/tag'
+require 'fixtures/tagging'
class AssociationsTest < Test::Unit::TestCase
@@ -1855,4 +1857,12 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
projects = Project.send(:select_limited_ids_list, {:order => 'developers.created_at'}, join_dep)
assert_equal %w(1 2), projects.scan(/\d/).sort
end
+
+ def test_scoped_find_on_through_association_doesnt_return_read_only_records
+ tag = Post.find(1).tags.find_by_name("General")
+
+ assert_nothing_raised do
+ tag.save!
+ end
+ end
end