ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Understanding ActiveRecord: A Gentle Introduction to the Heart of Rails (Part 2)
Subject:   Very good article, but a couple of errors
Date:   2007-05-11 23:30:45
From:   tfardella
This article did a great job of introducing ActiveRecord. The only problem I found were mistakes in the code presented that made it difficult to get everything working correctly. The 005_create_taggings.rb file should read:



class CreateTaggings < ActiveRecord::Migration
def self.up
create_table :taggings do |t|
t.column :entry_id, :integer
t.column :tag_id, :integer
end
end


def self.down
drop_table :taggings
end
end


The tags/index.rhtml file shown was mistakenly copied from the entries/index.rhtml file. It should read:



<h2>URLs for All Tags</h4>


<% @urls_for_tags.each do |tag,url_list|%>
<h3><%=tag%></h3>


    <% url_list.each do |url| %>
  • <%= url %>

  • <% end %>

<% end %>


If you download the source files linked to at the end of the article they contain the correct code.


Thanks for the great article. I hope to see more like it in the future, hopefully with better proof-reading.