rubyonrailsin

A Ruby and Rails talk

Sunday, March 14, 2010


[Rails] RESTful route question

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

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@googlegroups.com.
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.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive