Browse files

FIXED: error with url_for & link_to when we have nested resources.

  • Loading branch information...
1 parent 69b3c9c commit f7ac354f4ca6e800dd955cde8c3598740bd71c1d @linuxonrails linuxonrails committed with fxn Jun 3, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 railties/guides/source/routing.textile
@@ -288,7 +288,7 @@ When using +magazine_ad_path+, you can pass in instances of +Magazine+ and +Ad+
You can also use +url_for+ with a set of objects, and Rails will automatically determine which route you want:
-<%= link_to "Ad details", url_for(@magazine, @ad) %>
+<%= link_to "Ad details", url_for([@magazine, @ad]) %>
In this case, Rails will see that +@magazine+ is a +Magazine+ and +@ad+ is an +Ad+ and will therefore use the +magazine_ad_path+ helper. In helpers like +link_to+, you can specify just the object in place of the full +url_for+ call:

0 comments on commit f7ac354

Please sign in to comment.