Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

simple_form sending parameter

I'm trying to send an extra parameter submiting a form in rails using simple_form I thought this would do the trick:

<%= simple_form_for(@user, :groupId => 1) do |f| %>

but in tne controller, the parameter is ignored

I found an answer in here but I really like to have a better solution.

like image 460
tostasqb Avatar asked Oct 24 '25 06:10

tostasqb


1 Answers

How about:

<%= simple_form_for @user, url: user_path(@user, :groupId => 1) do |f| %>

simple_form_for has a similar usage to form_for. See http://apidock.com/rails/ActionView/Helpers/FormHelper/form_for

like image 170
Leonel Galán Avatar answered Oct 26 '25 18:10

Leonel Galán



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!