I need to pass parameters to a path so that the path looks like the following:
http://localhost/submission_app/submissions?search_submission_type=ISH&submission_status_arr[]=51
I tried
submissions_path(:search_submission_type => "ISH", :submission_status_arr[] => 51 )
But am getting wrong number of arguments (0 for 1..2) error message on my view page.
I then tried:
submissions_path("search_submission_type=ISH&submission_status_arr[]=51")
But this one gives me the following url (Note the dot instead of & before the argument)
http://localhost/submission_app/submissions.search_submission_type=ISH&submission_status_arr[]=51
How do I need to pass the parameters so that I get the correct format for the url?
Your suggestions are most appreciated. Thank you
Rails uses parameter[]=value to signify that parameter should be considered an array.
You just need to pass an array to the path helper to get rails to generate the path for you.
submissions_path(:search_submission_type => "ISH", :submission_status_arr => [51] )
Correct syntax is
submissions_path(:search_submission_type => "ISH", :submission_status_arr => [51] )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With