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! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Try this.... documents_path(:first => ''one'', :second => ''two'') On Tue, Feb 22, 2011 at 6:15 AM, paul <paul-mzPrHiy5csbYtjvyW6yDsg@public.gmane.org> wrote:> 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! > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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... On 22 February 2011 13:58, Hendra Gunawan <ultimesia777-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try this.... > > documents_path(:first => ''one'', :second => ''two'') > > > On Tue, Feb 22, 2011 at 6:15 AM, paul <paul-mzPrHiy5csbYtjvyW6yDsg@public.gmane.org> wrote: > >> 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! >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- Imran Latif, Software Engineer NextBridge Pvt. Ltd, Lahore +92-322-6526002 (Mobile) http://www.nextbridge.pk -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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? On Tue, Feb 22, 2011 at 4:28 AM, Imran Latif <ilatif.bwp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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... > On 22 February 2011 13:58, Hendra Gunawan <ultimesia777-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> Try this.... >> >> documents_path(:first => ''one'', :second => ''two'') >> >> On Tue, Feb 22, 2011 at 6:15 AM, paul <paul-mzPrHiy5csbYtjvyW6yDsg@public.gmane.org> wrote: >>> >>> 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! >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Ruby on Rails: Talk" group. >>> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> For more options, visit this group at >>> http://groups.google.com/group/rubyonrails-talk?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > -- > Imran Latif, Software Engineer > NextBridge Pvt. Ltd, Lahore > +92-322-6526002 (Mobile) > http://www.nextbridge.pk > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. On Tue, Feb 22, 2011 at 11:05 AM, Paul <paul-mzPrHiy5csbYtjvyW6yDsg@public.gmane.org> wrote:> 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.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.