Suppose I wanted to do this. Wouldn't the syntax be (in config/
routes.rb)

map.connect '/patients/find', :controller=>'patient', :action=>'find'

prepended to the standard, scaffold generated

map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'

--b

On May 7, 12:06 am, Colin Law <[email protected]> wrote:
> Since find is not one of the standard actions, have you included a specific
> route for patients/find?  The default routes generated by map.resources
> :patients will assume that find is a patient id, expecting to see patients/2
> for example.
>
> Colin
>
> 2009/5/6 big poppa <[email protected]>
>
>
>
> > sorry, that's a typo. it appears the way you suggested in my code (it
> > compiles).
>
> > i'll look into the routing some more, i was ready to bash my head in
> > last night and couldn't take it any more...
>
> > --b
>
> > On May 6, 12:59 am, Gul <[email protected]> wrote:
> > > The way you are receiving parameter is wrong it should be like this
>
> > >   @patients = Patient.find(:all, :conditions => { :location =>params
> > > [:search_string] })
>
> > > GUL
>
> > > On May 6, 12:40 pm, big poppa <[email protected]> wrote:
>
> > > > given the following code snippet:
>
> > > > class PatientsController < ApplicationController
> > > > ...
> > > > def find
> > > >   @patients = Patient.find(:all, :conditions => { :location =>
> > > > [params:search_string] })
> > > > end
>
> > > > I would like to add a few hard coded links (i.e. show me all the
> > > > patients in a particular location)
>
> > > > This makes sense to me:
>
> > > > <% link_to "=Hospital 1 census", {:controller=>"/
> > > > patients", :action=>"find", :search_string=>"Hospital 1"} %>
>
> > > > but gives me error "Couldn't find Patient with ID=find" (The above
> > > > link generates the URL example.com/patients/find?
> > > > search_string=Hillcrest)
>
> > > > I tried playing around with routes.rb, but got nowhere. What am I
> > > > doing wrong?
>
> > > > Thanks,
> > > > --b
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to