Routes Id issue in 2.3.5

Hi,
Routes.rb wants the id for doctors. I would love to give routes the
answer it is looking for, but I am not sure how to define an id in
rails. In c++ it would be something like int doctors(int id);
int doctors(int id)
{
// code
}
If someone could be kind enough to tell me what to pass as id to
routes that would be really helpful. Tutorial links on routes in 2.3.5
would also be helpful. I don’t want to upgrade to 3.0, because I’ve
already written a lot of it in rails 2.3.5.
Here is the error I am getting.
doctor_url failed to generate from
{:controller=>“doctors”, :action=>“show”} - you may have ambiguous
routes, or you may need to supply additional parameters for this
route. content_url has the following required parameters:
[“doctors”, :id] - are they all satisfied?

The_programmer wrote:

Hi,
Routes.rb wants the id for doctors. I would love to give routes the
answer it is looking for, but I am not sure how to define an id in
rails.

Your question appears to make little sense as stated. Try again with
more information:

  • What are you trying to achieve?
  • What does the relevant part of routes.rb look like?

[…]

Tutorial links on routes in 2.3.5
would also be helpful.

You mean like the rdoc for the Routing class?

I don’t want to upgrade to 3.0, because I’ve
already written a lot of it in rails 2.3.5.

Not a great reason. You may not want to upgrade right away, but you
should give some serious thought to doing so eventually. Since you’ve
been developing test-first (you have, right?), this should be relatively
easy.

Here is the error I am getting.
doctor_url failed to generate from
{:controller=>“doctors”, :action=>“show”} - you may have ambiguous
routes, or you may need to supply additional parameters for this
route. content_url has the following required parameters:
[“doctors”, :id] - are they all satisfied?

And what code is giving you that error?

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Thank you for the reply Marnen.
Yes, the rdoc for routes 2.3.5 would be very helpful. I am trying to
make my
Routes allow multiple doctors to have accounts. Since I won’t know what
Doctor is logging in, I am not sure what to give as the id. This is the
relevant piece of my routes.

map.resources :doctors

that is all I have for the relevant part of my code.
The routes.rb not being given the id is the cause for the error.

ryan satterfield wrote:

Thank you for the reply Marnen.
Yes, the rdoc for routes 2.3.5 would be very helpful.

Then look it up at http://www.railsapi.com or anywhere else.
ActionController::Routing and ActionController::Resources are the
modules to start with.

I am trying to
make my
Routes allow multiple doctors to have accounts. Since I won’t know what
Doctor is logging in,

Of course you will! Why do you think you won’t?

I am not sure what to give as the id. This is the
relevant piece of my routes.

map.resources :doctors

Please read the Resources rdoc as recommended above and most will come
clear.

Also, you probably shouldn’t be using map.resources :doctors for your
login interface. That’s meant for things like displaying information
about particular doctors. Please see how plugins such as Authlogic
recommend setting up your controllers and routes for login.

that is all I have for the relevant part of my code.

No it isn’t. What’s handling the login?

The routes.rb not being given the id is the cause for the error.

Right, but we have to see the code (probably your controller action)
that should be supplying that id.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]