rails simple_form - hidden field - create? rails simple_form - hidden field - create? ruby-on-rails ruby-on-rails

rails simple_form - hidden field - create?


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"


= f.input_field :title, as: :hidden, value: "some value"

Is also an option. Note, however, that it skips any wrapper defined for your form builder.