Flowdock
method

init_with

Importance_1
v6.0.0 - Show latest stable - 0 notes - Class: Core
init_with(coder, &block) public

Initialize an empty model object from coder. coder should be the result of previously encoding an Active Record model, using #encode_with.

class Post < ActiveRecord::Base
end

old_post = Post.new(title: "hello world")
coder = {}
old_post.encode_with(coder)

post = Post.allocate
post.init_with(coder)
post.title # => 'hello world'
Show source
Register or log in to add new notes.