Related methods

Defines an attributes writer for the specified association(s). If you are
using attr_protected or attr_accessible, then you will
need to add the attribute writer to the allowed list.

Supported options:

:allow_destroy

If true, destroys any members from the attributes hash with a
_destroy key and a value that evaluates to true (eg. 1,
‘1’, true, or ‘true’). This option is off by
default.

:reject_if

Allows you to specify a Proc or a Symbol pointing to a method that checks whether a
record should be built for a certain attribute hash. The hash is passed to
the supplied Proc or the method and it should
return either true or false. When no :reject_if is
specified, a record will be built for all attribute hashes that do not have
a _destroy value that evaluates to true. Passing
:all_blank instead of a Proc will create
a proc that will reject a record where all the attributes are blank.

:limit

Allows you to specify the maximum number of the associated records that can
be processed with the nested attributes. If the size of the nested
attributes array exceeds the specified limit,
NestedAttributes::TooManyRecords exception is raised. If omitted, any
number associations can be processed. Note that the :limit option is only
applicable to one-to-many associations.

:update_only

Allows you to specify that an existing record may only be updated. A new
record may only be created when there is no existing record. This option
only works for one-to-one associations and is ignored for collection
associations. This option is off by default.