Question from Super-Novice regarding Permalink

Hi-

I am two weeks new to Ruby on Rails and I am working through the
SitePoint book. Specifically Chapter 7. I am trying to do the
permalink example for a story posting in their example, but I am
getting an undefined method error. I have checked all the textmate
files, and they match. And I have gone into the ruby console to pull
the story up, find the name, but when i write:
s.update_attribute :permalink, 'my-shiny-weblog'. I get a the
following:

s.update_attribute :permalink, 'my-shiny-weblog'

NoMethodError: undefined method `permalink=' for #<Story:0x328d3c4>
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/base.rb:1858:in `method_missing'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/validations.rb:772:in `send'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/validations.rb:772:in `update_attribute'
        from (irb):25

First step in debugging this is to look at the error message. Your
controller called Story.find_by_permalink, and it blew up. Normally,
you'd just realize you either misspelled the method name, or are
calling it on the wrong object. Or, maybe you got drunk and deleted
it from your class :slight_smile:

However, ActiveRecord has "Dynamic attribute-based finders" (read
about them at http://rails.rubyonrails.org/classes/ActiveRecord/Base.html).
Basically, you can call Story.find_by_permalink as a shortcut for
Story.find(:first, :conditions => {:permalink => 'foo'}). So, if THIS
is failing, it probably means you have no permalink attribute in the
model's database table. Check and make sure it exists, you're
accessing the right DB, migrations have been run, etc etc.

The first update_attribute error supports this assumption as well.

Thnx. If my db only has the columns (schema_info, stories, and votes)
should I add a column called "permalink"? Or should the column be
another name?

-Zak