Ruby on Rails Saturday, February 4, 2017

You can put the parameters as an argument to a path like so:


=link_to "Add Special", add_special_path(work_day: @date), class: 'uk-button buffer-left-twice' which will make a url like


Or if you have a model that is already in the button, you put parameters after it like:

%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token)

This is from Devise on their default views




On Feb 4, 2017, at 10:13 AM, Hassan Schroeder <hassan.schroeder@gmail.com> wrote:

On Sat, Feb 4, 2017 at 12:13 AM, Greg Navis <contact@gregnavis.com> wrote:
button_to generates a form with a button. I'm not sure there's a way to add
custom hidden fields to the form. One way around the problem would be to

One way around the "problem" would be to read the documentation
for that method, which includes under "options"

:params - Hash of parameters to be rendered as hidden fields within the form.

FWIW,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAUOpp1nTzPOptHvOEX0td-do72Zq-qetytsbpwVWEY5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment