-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