From 72f51990b72482df41c1711b43e77f94177224be Mon Sep 17 00:00:00 2001 From: Linux on Rails Date: Fri, 3 Jun 2011 03:01:41 -0700 Subject: FIXED: error with url_for & link_to when we have nested resources. --- railties/guides/source/routing.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile index 08615bed4e..1cbc5c8f6e 100644 --- a/railties/guides/source/routing.textile +++ b/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: -- cgit v1.2.3