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') %>">

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

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

<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 %>
</td>
</tr>
<% end %>
</table>
</div>
<br />
<%= link_to 'New movie', :action => 'new' %>



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

5 comments:

Rahul said...

Hi Sean,
Awesome!! step by step guide to get the basics of RAILS 2.0. Would love to see some more continuation of this tutorials :)
Thanks
-Kumar

Anonymous said...

Hi! I was wondering if ruby on rails 2.0 had differences for the form.select helper. According with the tutorial of AWDWR, i used the helper in this way:

form.select ( :pay_type,
Order::PAYMENT_TYPES,
:prompt => "Select a payment method")

and found this error:

undefined method `pay_type' for #Order:0x3989380

Anonymous said...

Excellent tutorial and reference. Thank you, Sean.

Jamie said...

Sean, your tutorials are excellent. They are extremely easy to follow and understand. PLEASE MAKE MORE!!! I WOULD PAY!

Seriously, I would pay. These are great!

Now what do I do?!

Shah said...

Great Tutorial :)