method
init_with
rails latest stable - Class:
ActiveRecord::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'