-1
我在“查看”输入集合(simple_form),但该集合应该在模型中。ruby,simple_form Rails,collection
我必须声明其含有[“兄弟”,“女儿”,“父亲”,“朋友”,“丈夫”,“母亲”,“姐妹”,“儿子”,“妻子”]中的变量模型和考虑在这里使用:
= f.input :relationship
这是我的观点:
= simple_form_for @emergency_information, html: {class: 'form-horizontal' } do |f|
= f.error_notification
= f.input :name
= f.input :relationship, collection: ["Brother", "Daughter", "Father", "Friend", "Husband", "Mother", "Sister", "Son", "Wife"]
这是我的模型
class EmergencyInformation < ActiveRecord::Base
belongs_to :user
validates :user_id, :name, presence: true
end
请帮助我!
我不确定我是否理解这个问题。或者如果有的话。 – sevenseacat
我编辑了这个问题。 –
您的'emergency_information'表中是否包含名为'relationship'的属性? – lurker