module ActiveRecord::NestedAttributes::ClassMethods
def generate_association_writer(association_name, type)
the helper methods defined below. Makes it seem like the nested
This redirects the attempts to write objects in an association through
end
assign_nested_attributes_for_one_to_one_association(:pirate, attributes)
def pirate_attributes=(attributes)
could generate the following:
accessing the objects in the association. For example, this method
Generates a writer method for this association. Serves as a point for
def generate_association_writer(association_name, type) generated_association_methods.module_eval <<-eoruby, __FILE__, __LINE__ + 1 silence_redefinition_of_method :#{association_name}_attributes= def #{association_name}_attributes=(attributes) assign_nested_attributes_for_#{type}_association(:#{association_name}, attributes) end eoruby end