I have in routes.rb
map.resources :labs, :collection => { :group => :get }
which is working. But when I try to pass a parameter, e.g.
<% form_tag group_labs_path( :patient_id => @patient.id ), :method
=> :get do %>
The :patient_id isn''t getting passed to the controller:
--- !map:HashWithIndifferentAccess
group: !map:HashWithIndifferentAccess
id: "5"
commit: Add Lab
action: group
controller: labs
Doing it the non-restful way works:
<% form_tag :action => :group, :patient_id => @patient.id, :method
=> :get do %>
--- !map:HashWithIndifferentAccess
group: !map:HashWithIndifferentAccess
id: "6"
commit: Add Lab
method: get
authenticity_token: ...
action: group
patient_id: "8"
controller: labs
Any idea how to configure the route to pass the parameter?
Many TIA,
Craig
--
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.
Have you tried just making a hidden field for the patient id? Since you''re submitting a form as a GET request, it should post all form data in the URL. On Mar 14, 10:50 am, Dudebot <craign...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have in routes.rb > > map.resources :labs, :collection => { :group => :get } > > which is working. But when I try to pass a parameter, e.g. > > <% form_tag group_labs_path( :patient_id => @patient.id ), :method > => :get do %> > > The :patient_id isn''t getting passed to the controller: > > --- !map:HashWithIndifferentAccess > group: !map:HashWithIndifferentAccess > id: "5" > commit: Add Lab > action: group > controller: labs > > Doing it the non-restful way works: > > <% form_tag :action => :group, :patient_id => @patient.id, :method > => :get do %> > > --- !map:HashWithIndifferentAccess > group: !map:HashWithIndifferentAccess > id: "6" > commit: Add Lab > method: get > authenticity_token: ... > action: group > patient_id: "8" > controller: labs > > Any idea how to configure the route to pass the parameter? > > Many TIA, > Craig-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 15, 7:59 am, daphonz <cdre...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Have you tried just making a hidden field for the patient id?That''s an interesting design thought, which I''ll play with. But it seems to me I should still be able to configure the route in a RESTful way. Any idea how? -- 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.
> On Mar 15, 7:59 am, daphonz <cdre...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Have you tried just making a hidden field for the patient id?BTW <% form_tag group_labs_path, :method => :get do %> <%= hidden_field_tag :patient_id, @patient.id %> works perfectly of course :) (Thanks!) But I still don''t understand why <% form_tag group_labs_path( :patient_id => @patient.id ), :method => :get do %> isn''t permitted syntax. Someday I''ll understand RESTful routes, but not today :) -- 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.