"Select" f.s...">

Use with_options with Rails Form Helper

I have a form that has: prompt => "Select" on many inputs:

f.select :country, :prompt => "Select"
f.select :city, :prompt => "Select"
...

      

Is there a way to wrap this up using with_options and dry it?

+2


source to share


1 answer


This should work :)



f.with_options: prompt => "Select" do | form |
  form.select: country
  form.select: city
end
+5


source







All Articles