He estado tratando de seguir el Active Record Nested Attributes Guide, sin mucho éxito.Rails accepts_nested_attributes_for Error, ayúdeme a detectarlo
tengo los siguientes modelos:
class Contact < ActiveRecord::Base
has_many :telephones
accepts_nested_attributes_for :telephones
end
class Telephone < ActiveRecord::Base
belongs_to :contact
end
Al intentar crear un contacto:
contact = {
:name => "John",
:telephones => [
{:telephone => '787445741'},
{:telephone => '478589658'}
]
}
Contact.create(contact)
me sale el siguiente error: ActiveRecord::AssociationTypeMismatch: Telephone(#80827590) expected, got Hash(#72886250)
Podría usted por favor me ayuden a Spot the ¿error? ¿Hay algún código que deba incluir en el contact_controller.rb
?