【发布时间】:2010-01-21 18:15:42
【问题描述】:
我有一个自定义表单构建器,这个自定义构建器的一个原因是,对于每个表单,我都需要包含一些额外的参数,我不想在每个表单中使用隐藏字段标签显式放入这些参数。写。
for_for(@foo, :builder => MyBuilder) do |f|
# stuff I shouldn't have to worry about
# this should be put in all the time without me having to do it
hidden_field_tag('extra', 'myextrainfo')
# normal things I would put in
f.text_field(:bar)
end
我必须在我的自定义表单构建器中做什么,或者我可以覆盖或方法链以在表单中添加一些额外的隐藏内容(不只是添加 URL 参数)?
【问题讨论】:
标签: ruby-on-rails ruby forms