Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v3.2.13) is shown here.
init_with(coder)
public
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
# File activerecord/lib/active_record/base.rb, line 514
def init_with(coder)
@attributes = self.class.initialize_attributes(coder['attributes'])
@relation = nil
@attributes_cache, @previously_changed, @changed_attributes = {}, {}, {}
@association_cache = {}
@aggregation_cache = {}
@readonly = @destroyed = @marked_for_destruction = false
@new_record = false
run_callbacks :find
run_callbacks :initialize
self
end