Reputation: 414
I've got this form tag from which I want to retrieve a starting date and end date (dd/mm/yy):
<%= form_with(url: "dashboard/index", method: "get") do %>
<%= date_select :start_date, :date_att %>
<%= date_select :end_date, :date_att %>
<%= submit_tag("Apply") %>
<% end %>
This is what I'm doing in my controller once the 'Apply' button has been pushed:
start_f = params[:start_date]
which I expect to give me {"date_att(1i)"=>"2019", "date_att(2i)"=>"10", "date_att(3i)"=>"31"}
but instead I get <ActionController::Parameters {"date_att(1i)"=>"2019", "date_att(2i)"=>"10", "date_att(3i)"=>"31"} permitted: false>
I tried looking for ways to make the permitted attribute TRUE but I don't understand.
Can anyone help me on this one ? Cheers.
Upvotes: 1
Views: 103
Reputation: 23307
You need to use strong parameters, sth like:
start_f = params.permit(:start_date)[:start_date]
Upvotes: 1