rails simple_form - hidden field - create?
How can you have a hidden field with simple form?
The following code:
= simple_form_for @movie do |f|
= f.hidden :title, "some value"
= f.button :submit
results in this error:
undefined method `hidden' for #SimpleForm::FormBuilder:0x000001042b7cd0
try this
= f.input :title, :as => :hidden, :input_html => { :value => "some value" }
Shortest Yet !!!
=f.hidden_field :title, :value => "some value"
Shorter, DRYer and perhaps more obvious.
Of course with ruby 1.9 and the new hash format we can go 3 characters shorter with...
=f.hidden_field :title, value: "some value"