Flowdock
assign_nested_attributes_for_one_to_one_association(association_name, attributes) private

Assigns the given attributes to the association.

If an associated record does not yet exist, one will be instantiated. If an associated record already exists, the method’s behavior depends on the value of the update_only option. If update_only is false and the given attributes include an :id that matches the existing record’s id, then the existing record will be modified. If no :id is provided it will be replaced with a new record. If update_only is true the existing record will be modified regardless of whether an :id is provided.

If the given attributes include a matching :id attribute, or update_only is true, and a :_destroy key set to a truthy value, then the existing record will be marked for destruction.

Show source
Register or log in to add new notes.