views:

64

answers:

3

The scaffold command is the following

ruby script\generate scaffold Leave employee_id:integer leave_type_id:integer date:date

I know I could change the name but I just wonder why it always throws undifined new_leave_path

Glad to know your brilliant thoughts.

Below is the full details of the error:


NameError in Leaves#index

Showing app/views/leaves/index.html.erb where line #26 raised:

undefined local variable or method `new_leave_path' for #<ActionView::Base:0x620ea70>

Extracted source (around line #26):

23: 
24: <br />
25: 
26: <%= link_to 'New leave', new_leave_path %>

Application trace:

app/views/leaves/index.html.erb:26
app/controllers/leaves_controller.rb:7:in `index'
A: 

@insic Hi

It is just working fine on my machine. may be there are some conflicts with any gem or plugin that you might be using. Can't explicitly find out what is the exact reason, as I am a newbie to rails.

Rohit
A: 

Add

#routes.rb
map.resources :leaves
mark
yes it is in place. the generate scaffold command automatically add it to routes.rb
insic
Try running rake routes in terminal from the root directory of your application to check the route is being generated.
mark
+3  A: 
rake routes

new_leafe_path

or

map.resources :leaves, :singular => :leave

)

Bohdan Pohorilets
thanks! it works now. :)
insic