Rails - BD Relationship

2

I have a user table, where I have a required field cidade , and I have a contatos table (which is belongs_to: user ), but in the form it does not have the cidade field that is required for user . How do I put the city field being optional in the model contato ?

I made belongs_to > optional: true and it did not work.

No models / user.rb I'm doing this validation with validate_presence_of

    
asked by anonymous 15.10.2018 / 17:33

1 answer

1

Try this:

belongs_to :user, optional: true
    
15.10.2018 / 20:22