I am trying pass array as parameter to my controller method but it's not working for me. I tried it in following ways:
http://localhost:3000/med?med_ids=[2,1]
I tried in following way as well and its working for me. I just want to know any good solution
http://localhost:3000/manufacturer/1/medicines?medicine_id[]=2&medicine_id[]=1
inside controller:
@val = params[:medicine_id]
values are coming but I want to make it as array.
Need some help. Thank you.
params[:medicine_id]?medicine_id%5B%5D=2&medicine_id%5B%5D=1?medicine_id[]=2&medicine_id[]=1is working for you. And this is the correct way to pass array in query string