diff options
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 27c4168c63..92852375ec 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Add notes to documentation regarding attr_readonly behavior with counter caches and polymorphic associations. Closes #9835 [saimonmoore, rick] + * Observers can observe model names as symbols properly now. Closes #9869 [queso] * find_and_(initialize|create)_by methods can now properly initialize protected attributes [Tobias Luetke] diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index ab4e02f86c..3bf660f7b2 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -775,8 +775,11 @@ module ActiveRecord # destroyed. This requires that a column named <tt>#{table_name}_count</tt> (such as +comments_count+ for a belonging +Comment+ class) # is used on the associate class (such as a +Post+ class). You can also specify a custom counter cache column by providing # a column name instead of a +true+/+false+ value to this option (e.g., <tt>:counter_cache => :my_custom_counter</tt>.) + # Note: Specifying a counter_cache will add it to that model's list of readonly attributes using #attr_readonly. # * <tt>:include</tt> - specify second-order associations that should be eager loaded when this object is loaded. # * <tt>:polymorphic</tt> - specify this association is a polymorphic association by passing +true+. + # Note: If you've enabled the counter cache, then you may want to add the counter cache attribute + # to the attr_readonly list in the associated classes (e.g. class Post; attr_readonly :comments_count; end). # # Option examples: # belongs_to :firm, :foreign_key => "client_of" |