aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2006-03-30 22:27:32 +0000
committerMarcel Molina <marcel@vernix.org>2006-03-30 22:27:32 +0000
commit3f049b0b6b5a338786c3dfafb31edf937f4ecb13 (patch)
tree8a50caa833b407feca119b5d2de61ba9e46ce299 /activerecord/lib/active_record
parent58dd49a7ae13471b8f8e359286307853bfc22529 (diff)
downloadrails-3f049b0b6b5a338786c3dfafb31edf937f4ecb13.tar.gz
rails-3f049b0b6b5a338786c3dfafb31edf937f4ecb13.tar.bz2
rails-3f049b0b6b5a338786c3dfafb31edf937f4ecb13.zip
Do not implicitly mark recordss of has_many :through as readonly but do mark habtm records as readonly (eventually only on join tables without rich attributes).
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4107 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb2
-rwxr-xr-xactiverecord/lib/active_record/base.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
index 9bc29b049f..3f6fdb6bac 100644
--- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -41,7 +41,7 @@ module ActiveRecord
options[:conditions] = conditions
options[:joins] = @join_sql
- options[:readonly] ||= false
+ options[:readonly] ||= !options[:joins].nil?
if options[:order] && @reflection.options[:order]
options[:order] = "#{options[:order]}, #{@reflection.options[:order]}"
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index f6bee7b6ae..8078b4113b 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1325,7 +1325,7 @@ module ActiveRecord #:nodoc:
unless options.has_key?(:readonly)
if scoped?(:find, :readonly)
options[:readonly] = scope(:find, :readonly)
- elsif !options[:joins].blank?
+ elsif !options[:joins].blank? && !options[:select]
options[:readonly] = true
end
end
@@ -2064,4 +2064,4 @@ module ActiveRecord #:nodoc:
value
end
end
-end \ No newline at end of file
+end