I have a list of checkboxes within a form, which has two buttons. I'm trying to pass in separate paramaters to the buttons as described here:
Is there a way to pass params when clicking submit button in simple_form view in rails 3.2.12?
But it's not passing in the parameters. My code is as follows:
<%= simple_form_for :pupils, url: edit_multiple_school_group_pupils_path(school, group) do |f| %>
...
...
<%= f.button :submit, 'Change Levels', name: 'editing', value: 'levels' %>
<%= f.button :submit, 'Move to A Class', name: 'editing', value: 'classes' %>
<% end %>
I've tried various other methods, and have seen a few posts about giving the buttons separate ids and calling params[:commit], however no commit params are sent.
Any help is greatly appareciated.
EDIT:
The HTML output of the form buttons are:
<input type="submit" name="editing" value="levels" class="btn" />
<input type="submit" name="editing" value="classes" class="btn" />
Rails console log:
Started POST "/school/2/classes/3/pupils/edit_multiple" for 127.0.0.1 at 2017-08-08 17:08:58 +0100
Processing by Schools::Admin::PupilsController#edit_multiple as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"0ncVG1+MfuS13ystwdUe/vEzF30f1iHS/F0u0DDflOXKnkw8hcUhv/n2eJZuZHOA4gZxuITahMFbyTdG/B5cEQ==", "pupil_ids"=>["134", "129"], "school_id"=>"2", "group_id"=>"3"}