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

And if you want to link to a certain post regardless of which blog it
belongs to, define map.resources :posts outside of the blog block.

On Dec 23, 2007 3:20 PM, Jean-Sébastien [email protected]
wrote:

end

Thanks


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.

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

On Dec 22, 2007 8:29 PM, Jon G. [email protected] wrote:

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.


http://www.rubyplus.org/
Free Ruby Screencasts

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 T. list !

– Jean-François.