Friday, February 29, 2008

Rails 2.0 Step by Step (part 2.1)

Rails 2.0 Step by Step (part 2.1)

This is a short post to address an error I made in my part 2 post. I posted a bad copy of the index.html.erb file, and I apologize to those of you who read my blog. Thanks to your comments my error was caught.

The correct code you should use in the index.html.erb file is below, just cut and paste this block:

<div id="movie-list">
<h1>Movie Listing</h1>

<table cellpadding="5" cellspacing="0">
<% for movie in @movies %>
<tr valign="top" class="<%= cycle('list-line-odd', 'list-line-even') %>">

<img class="list-one-sheet" src="<%= movie.one_sheet_url %>"/>

<td width="60%">
<span class="list-title"><%= h(movie.title) %></span><br />
<%= h(truncate(movie.description, 80)) %>

<td class="list-actions">
<%= link_to 'Show', movie %>
<%= link_to 'Edit', edit_movie_path(movie) %>
<%= link_to 'Destroy', movie, :confirm => 'Are you sure?', :method => :delete %>
<% end %>
<br />
<%= link_to 'New movie', :action => 'new' %>

Note: I have just gone back and edited part 2 to include this correction.