作者:詹慧君874 | 来源:互联网 | 2023-09-11 11:43
I have two models as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| ruby
class User
include Mongoid::Document
has_one :contact, autosave: true
...
end
class Contact
include Mongoid::Document
belongs_to :user # contact information for user
...
end |
In my form I have the following code.
1 2 3
| haml
= semantic_form_for , html: { class: "form-horizontal"} do |f|
= f.input :contact, as: :select |
It is giving me an error of:
1 2
| undefined method &#096;user_id&#039; for #<0x007f81cac2ee00>
0x007f81cac2ee00> |
Is there something special I need to be doing here?
该提问来源于开源项目:formtastic/formtastic
just randomly ran into this issue. would be great if the documentation would have some kind of hint that
relationships only work with a workaround