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
)
注:我不想创建国家&城市独立数据库字段。