0
Error : Undefined method 'address' for #Contact:object memory code
I’m running a Rails test. I want to check a table address for an instantiated contact object: contact has_one address.
I am using the Rails Console and running the code below:
contato = Contact.first
contato.address.street
And I get the mistake.
In the contact model you have an association as follows:
has_one :address
NOTE: In the migrate address there is a reference to contact.
Your Address template has a belongs_to :contact ?
– Davis Roberto