freeze

freeze() Instance Public methods Clone and freeze the attributes hash such that associations are still accessible, even on destroyed records, but cloned models will not be frozen.

frozen?

frozen?() Instance Public methods Returns true if the attributes hash has been frozen.

hash

hash() Instance Public methods Delegates to id in order to allow two records of the same type and id to work with something like: [ Person.find(1), Person.find(2), Person.find(3) ] & [ Person.find(1), Person.find(4) ] # => [ Person.find(1) ]

init_with

init_with(coder) Instance Public methods Initialize an empty model object from coder. coder must contain the attributes necessary for initializing an empty model object. For example: class Post < ActiveRecord::Base end post = Post.allocate post.init_with('attributes' => { 'title' => 'hello world' }) post.title # => 'hello world'

inspect

inspect() Instance Public methods Returns the contents of the record as a nicely formatted string.

readonly!

readonly!() Instance Public methods Marks this record as read only.

readonly?

readonly?() Instance Public methods 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.

slice

slice(*methods) Instance Public methods Returns a hash of the given methods with their names as keys and returned values as values.

decrement_counter

decrement_counter(counter_name, id) Instance Public methods Decrement a numeric field by one, via a direct SQL update. This works the same as #increment_counter but reduces the column value by 1 instead of increasing it. Parameters counter_name - The name of the field that should be decremented. id - The id of the object that should be decremented or an Array of ids. Examples # Decrement the post_count column for the record with an id of 5 DiscussionBoard.decrement_counter(:p

increment_counter

increment_counter(counter_name, id) Instance Public methods Increment a numeric field by one, via a direct SQL update. This method is used primarily for maintaining counter_cache columns that are used to store aggregate values. For example, a DiscussionBoard may cache posts_count and comments_count to avoid running an SQL query to calculate the number of posts and comments there are, each time it is displayed. Parameters counter_name - The name of the field that should be incremen