diff options
author | Marcel Molina <marcel@vernix.org> | 2007-12-05 14:55:54 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2007-12-05 14:55:54 +0000 |
commit | 8c2177c49d4ca49ba119948470c39aa0ab0e2951 (patch) | |
tree | c1698f7e5230adedaf3a747b160062bbec4d3576 /activerecord/lib | |
parent | 4570cf66cea1ab8b0486ad42823fe04182a5b5d2 (diff) | |
download | rails-8c2177c49d4ca49ba119948470c39aa0ab0e2951.tar.gz rails-8c2177c49d4ca49ba119948470c39aa0ab0e2951.tar.bz2 rails-8c2177c49d4ca49ba119948470c39aa0ab0e2951.zip |
Add documentation for freeze and readonly related methods. Closes #8878 [pelargir, jeremymcanally]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8286 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 28f60aa639..616b164b13 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2026,25 +2026,28 @@ module ActiveRecord #:nodoc: id.hash end - # Just freeze the attributes hash, such that associations are still accessible even on destroyed records. + # Freeze the attributes hash such that associations are still accessible, even on destroyed records. def freeze @attributes.freeze; self end + # Returns +true+ if the attributes hash has been frozen. def frozen? @attributes.frozen? end - # Records loaded through joins with piggy-back attributes will be marked as read only as they cannot be saved and return true to this query. + # Returns +true+ if the record is read only. Records loaded through joins with piggy-back + # attributes will be marked as read only since they cannot be saved. def readonly? @readonly == true end - def readonly! #:nodoc: + # Marks this record as read only. + def readonly! @readonly = true end - # Nice pretty inspect. + # Returns the contents of the record as a nicely formatted string. def inspect attributes_as_nice_string = self.class.column_names.collect { |name| if has_attribute?(name) || new_record? |