Nested routes

ROR 2.0.2

I have: map.resources :blogs do |blog|     blog.resources :posts   end

in my routes.rb

I am calling the route as: link_to "(manage)", posts_path(@blog)

I get the following error: Undefined method `posts_path' for #<ActionView::Base:0xb74caa38>

I am sure it is something stupid, but I can't figure out what.

Thanks

path should be blog_posts_path, there 's a name prefice since rails 2. you can do "rake routes" to check your routes. regards

ROR 2.0.2

I have: map.resources :blogs do |blog| blog.resources :posts end

This is the old way. The new way:

map.resources :blogs, has_many :posts end

in my routes.rb

I am calling the route as: link_to “(manage)”, posts_path(@blog)

Use rake:routes to list all the available routes and how they are mapped to an action.

Thanks to all, I am just learning this REST stuff, and am finally getting it.

Jon

Bala, that throws a syntax error, so something is wrong.

map.resources :blogs, has_many :posts end

Jon :

map.resources :blogs,     has_many :posts   end

map.resources :blogs, :has_many => :posts

For better help, please send your questions on the Ruby on Rails Talk mailing list.

   -- Jean-François.

myself :

Jon : > map.resources :blogs, > has_many :posts > end

map.resources :blogs, :has_many => :posts

For better help, please send your questions on the Ruby on Rails Talk mailing list.

Sorry, I thought we were on Ruby Talk list !

   -- Jean-François.