From 2bcac56ab4059356f9f1a0f0d970fd3c9d225f65 Mon Sep 17 00:00:00 2001 From: James Miller Date: Thu, 26 Aug 2010 12:10:21 -0700 Subject: Prefer modern idiom for rendering partials on a collection --- railties/guides/source/getting_started.textile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index dc60377e34..48393d2156 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -1056,8 +1056,7 @@ Then in the +app/views/posts/show.html.erb+ you can change it to look like the f

Comments

-<%= render :partial => "comments/comment", - :collection => @post.comments %> +<%= render @post.comments %>

Add a comment:

<%= form_for([@post, @post.comments.build]) do |f| %> @@ -1127,8 +1126,7 @@ Then you make the +app/views/posts/show.html.erb+ look like the following:

Comments

-<%= render :partial => "comments/comment", - :collection => @post.comments %> +<%= render @post.comments %>

Add a comment:

<%= render "comments/form" %> @@ -1381,8 +1379,7 @@ Finally, we will edit the app/views/posts/show.html.erb template to sho

Comments

-<%= render :partial => "comments/comment", - :collection => @post.comments %> +<%= render @post.comments %>

Add a comment:

<%= render "comments/form" %> @@ -1436,8 +1433,7 @@ Now you can edit the view in app/views/posts/show.html.erb to look like

Comments

-<%= render :partial => "comments/comment", - :collection => @post.comments %> +<%= render @post.comments %>

Add a comment:

<%= render "comments/form" %> -- cgit v1.2.3 From 0631bf4baf463a0e8ca74c56a21ed0b320d254d0 Mon Sep 17 00:00:00 2001 From: James Miller Date: Thu, 26 Aug 2010 12:27:44 -0700 Subject: Simplify render :partial --- railties/guides/source/action_view_overview.textile | 2 +- railties/guides/source/performance_testing.textile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/action_view_overview.textile b/railties/guides/source/action_view_overview.textile index e242cdaf73..459d70f111 100644 --- a/railties/guides/source/action_view_overview.textile +++ b/railties/guides/source/action_view_overview.textile @@ -428,7 +428,7 @@ A method for caching fragments of a view rather than an entire action or page. T <% cache do %> - <%= render :partial => "shared/footer" %> + <%= render "shared/footer" %> <% end %> diff --git a/railties/guides/source/performance_testing.textile b/railties/guides/source/performance_testing.textile index 65f8d07e7a..7b21485ea0 100644 --- a/railties/guides/source/performance_testing.textile +++ b/railties/guides/source/performance_testing.textile @@ -469,7 +469,7 @@ And in "views":http://api.rubyonrails.org/classes/ActionController/Benchmarking/ <% benchmark("Showing projects partial") do %> - <%= render :partial => @projects %> + <%= render @projects %> <% end %> -- cgit v1.2.3