我想使用,form_for
除了我有使用citier
gem 的类表继承模型。它们是这样定义的:
class Fruit < ActiveRecord::Base
# calories:integer
# color:string
end
class Apple < Fruit
# is_sauce:boolean
end
class Banana < Fruit
# is_peeled:boolean
end
问题是我希望表单的第一部分填写Fruit
模型的属性。然后根据关于什么类型的水果 ( Apple
, Banana
) 的选择字段,然后我想填写该特定模型的属性,但我仍然希望使用form_for
助手进行验证。关于如何解决这个问题的任何建议......或额外的澄清?谢谢。