aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-09-30 07:09:44 +0000
committerRick Olson <technoweenie@gmail.com>2007-09-30 07:09:44 +0000
commit66d05f5e2c7ac6b18220956fbcf34efcd32638fc (patch)
tree6544dd694d02af7438489a4864daec9c2bdce0b5 /activerecord/lib/active_record/associations.rb
parent30a652ad41428b922b1ed637f491776f1f1dff13 (diff)
downloadrails-66d05f5e2c7ac6b18220956fbcf34efcd32638fc.tar.gz
rails-66d05f5e2c7ac6b18220956fbcf34efcd32638fc.tar.bz2
rails-66d05f5e2c7ac6b18220956fbcf34efcd32638fc.zip
Add attr_readonly to specify columns that are skipped during a normal ActiveRecord #save operation. Closes #6896 [dcmanges]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7693 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index e269775fd5..1ec7d6021f 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -841,7 +841,11 @@ module ActiveRecord
module_eval(
"before_destroy '#{reflection.name}.class.decrement_counter(\"#{cache_column}\", #{reflection.primary_key_name})" +
" unless #{reflection.name}.nil?'"
- )
+ )
+
+ module_eval(
+ "#{reflection.class_name}.send(:attr_readonly,\"#{cache_column}\".intern) if defined?(#{reflection.class_name})"
+ )
end
end