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'
doc_ruby_on_rails
2015-06-20 00:00:00
Comments
Leave a Comment

Please login to continue.