Paul8
(Paul)
1
I've got the following RESTful route:
resources :documents
I need to call the index action with two extra parameters, so my url
will look like:
/documents/?first=one&second=two
Unfortunately, the second parameter seems to be swallowed up. The
first one appears normally, though. That is, in my log file, I see:
Parameters: {"first"=>"one"}
Why is that, and how can I get both parameters to get passed through?
Thanks!
Try this…
documents_path(:first => ‘one’, :second => ‘two’)
Please! also try to add the following line in your “routes.rb”
resources :documents, :collection => {:index => :get}
I hope this will solve your problem.
Thanks…
Paul8
(Paul)
4
I am sending the URL like this:
curl http://localhost:3000/documents/?first=one&second=two
So it is not a matter of constructing the URL.
I put the :collection parameter in my route file and now the log reports:
Started GET "/documents/?first=one" for etc...
Processing by DocumentsController#index as
Parameters: {"first"=>"one", "collection"=>{"index"=>:get}}
Any other suggestions?
Paul8
(Paul)
5
Whoops -- it was a matter of constructing the url. curl was
interpreting the ampersand as a command divider, so this worked:
curl 'http://localhost:3000/documents/?first=one&second=two’
Sorry.