As you have a has_one
association setup between Company
and PostalAddress
, you would need to use
@address = @company.build_postal_address
UPDATE
Association in Company
should look like:
has_one :postal_address, as: :address, dependent: :destroy
Use postal_address
and not postaladdress
as your model name is PostalAddress
and not Postaladdress
NOTE:
Just for reference, if you had has_many
association, then it would have been as:
@address = @company.postal_address.build
For additional details, read about Auto-generated methods for Associations