Topic: an error occured while doing project with tutorial. Plz help

Dear friends,

I am new to ruby on rails. I have installed instant rails from I trying to learn it by doing a step by step sample given in the I have successfully. I created two my own project also. One project is working fine. The second is not working. When I trying to browse the application it gives me an error

undefined local variable or method `new_patients_path' for #<ActionView::Base:0x9857b50>

The difference between these two project are (as per my understandings) followings.

$ script/generate scaffold Doctor name:string title:string degree: string

$ script/generate scaffold Patients name:string title:string location: string

First one is working fine. Previously I had same problem with the 1st one when I run the scaffold command with Doctors. When I changed it to Doctor it worked file. Can somebody tall me the issue behind this? I am struck with this issue.

Thanks and Regards

Re: an error occured while doing project with tutorial. Plz help

Hello Shihab,

When you use a path helper like 'new_patients_path' the route "new_patients" must be defined in your routes.rb config file. To know which routes are available in your application, run the command "rake routes". You path helper should probably be "new_patient_path" (without 's').

When you use the "script/generate scaffold" command, you should use "Patient" and not "Patients" because the scaffold command expects a model name, and in Rails model names are singular by convention (see "script/generate scaffold --help")

Hope that helps,