Prevent form_with from generating a parameter and submitting it (all by itself)?

171 Views Asked by At

When a form_with submits, it submits all the desired parameters, but also a parameter called "booking", and I have absolutely no idea where this parameter came from. It's not contained in the view, nor in the controller. It seems form_with is generating it from somewhere, but I have no idea how/why?

I could allow it as a permitted parameter, to prevent an Unpermitted parameter: :booking error, and just ignore it, but I would prefer to know what's going on and remove the extraneous parameter.

Why is form_with generating an unwanted parameter, and how can I stop it from doing so?

  <%= form_with(url: '/booking-confirm', method: :post, local: false) do |f| %> 

  <br>Select a time:<br><br>
    <% days.each do |day, availabilities| %> 
      <% availabilities.each do |avail| %>
          <%= f.label avail.time_slot %> 
          <%= radio_button_tag(:time_slot, avail.time_slot) %><br>
        <% end %> 
        <hr>
      <% end %>
      
  <%= f.submit "Confirm!", class: "btn btn-primary" %>
  <% end %> 

Notice there's no reference to any booking param anywhere in the code (the closest thing is url: '/booking-confirm')

0

There are 0 best solutions below