Today I Learned

hashrocket A Hashrocket project

How to add hidden fields to button_to

The button_to helper take a params key to add hidden fields to the form it renders:

<%= button_to "Delete", users_path, method: :delete, params: {send_email: false} %>

Produces:



Delete


Looking for help? Hashrocket has been an industry leader in Ruby on Rails since 2008. Rails is a core skill for each developer at Hashrocket, and we'd love to take a look at your project. Contact us and find out how we can help you.