Return to Snippet

Revision: 16610
at August 9, 2009 08:25 by webstic


Initial Code
partial a _preview in posts/index.html.erb
-------------
way_1

code @ index.html.erb

<%= render :partial => "posts/preview", :collection => @posts, :as => :post %>


code @ _preview.html.erb

<% div_for post do %>
	<h2><%= link_to_unless_current h(post.title), post %></h2>
	<%= truncate(post.body, :length => 300) %> <stule class="read_more"><%= link_to_unless_current h("read more"), post %></style> <br /><br />
<% end %>
-------------

way_2

code @ index.html.erb

<%= render :partial => "preview" %>

code @ _preview.html.erb

<% for post in @posts do %>
<% div_for post do %>
	<h2><%= link_to_unless_current h(post.title), post %></h2>
	<%= truncate(post.body, :length => 300) %> <stule class="read_more"><%= link_to_unless_current h("read more"), post %></style> <br /><br />
	<% end %>
<% end %>

-------------

Initial URL

                                

Initial Description

                                

Initial Title
partial a _preview in posts index.html.erb

Initial Tags
rails, ruby

Initial Language
Ruby