Flowdock
method

init_with

Importance_1
Ruby on Rails latest stable (v4.2.7) - 0 notes - Class: Core
init_with(coder) 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.