Rails

Use Form_for Or Simple_form_for Methods Without Any Form Tag In Rails

Posted by Weston Ganger on April 28, 2016

I wanted to use the form_for or simple_form_for input helpers without having a form tag.

I never thought you could use fields_for outside of form_for but you definitely can.


- fields_for @user do |f|
  = f.label :name, "Name"
  = f.text_field :email, "Email"

# OR If you use Simple_Form

- simple_fields_for @user do |f|
  = f.input :email

Now you can can have simple inputs that can be easily used anywhere.


Related External Links:


Posted in Rails and Tagged with rails simple_form forms 


Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts