method
marshal_load
v7.2.3 -
Show latest stable
- Class:
ActiveRecord::Marshalling::Methods
marshal_load(state)public
No documentation available.
# File activerecord/lib/active_record/marshalling.rb, line 43
def marshal_load(state)
attributes_from_database, new_record, associations = state
attributes = self.class.attributes_builder.build_from_database(attributes_from_database)
init_with_attributes(attributes, new_record)
if associations
associations.each do |name, target|
association(name).target = target
rescue ActiveRecord::AssociationNotFoundError
# the association no longer exist, we can just skip it.
end
end
end