I am writing a report module that allows users to select the dates of the report and export the corresponding report to excel. So, I use a active model to store the dates. In the view, I have a link for users to download reports. I want it goes to the create action in the controller so that I can get the report with correct date.
<%= render partial: 'reports/select_dates_form' %>
<p>
Download:
<%= link_to "Excel", reports_A_reports_path(:report, :end_date => @report.end_date, :start_date => @report.start_date), :method => :post, format: "xls" %>
</p>
In the controller, I defined a create_param method to define the params.
def create_params
params.require(:reports_A_report).permit(:end_date, :start_date)
end
However, it gives error "param is missing or the value is empty: reports_A_report". I try to various way to pass the params but still cannot success.
link_toandpost methodno noooo...