0
我有一個student
模型與字段:name, :address
。可能的鋼軌形式字段?
我想創建2個不同的字段:country, :city
,填寫並提交時,將連接到address
db字段。
怎麼辦?我必須在student.rb
中定義一些東西嗎?或者只是一些表單視圖?
我的學生/ _form.haml:
= simple_form_for @student do |f|
= f.input :name
= f.input :country #not in db
= f.input :city #not in db
= f.button :submit
(地址必須等於country + " " + city
)
注:我不想創建國家&城市獨立數據庫字段。