[英]Use with_options with the Rails form helper
I have form that has :prompt => "Select" on many inputs: 我有很多输入上具有:prompt =>“ Select”的表格:
f.select :country, :prompt => "Select"
f.select :city, :prompt => "Select"
...
Is there a way to wrap this using with_options and DRY it up? 有没有一种方法可以使用with_options包装并干燥它?
This should work :) 这应该工作:)
f.with_options :prompt => "Select" do |form| form.select :country form.select :city end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.