undefined method `updated_at' for #<Classified:0x686c5e4>

HEllo, I have the following problem with rails, I am new in this...is there anyone who explain to me what´s happens? Thanks See below:

NoMethodError in Classified#show Showing app/views/classified/show.rhtml where line #17 raised:

undefined method `updated_at' for #<Classified:0x686c5e4>

Extracted source (around line #17):

14: 15: <strong>Date Posted:</strong> <%= distance_of_time_in_words_to_now(@classified.created_at) %> ago <br /> 16: 17: <strong>Last updated:</strong> <%= distance_of_time_in_words(@classified.updated_at, Time.now) %> ago </p> 18: <p><%= @classified.description %></p> 19: 20: <hr/>

RAILS_ROOT: ./script/../config/..

Application Trace | Framework Trace | Full Trace c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1792:in `method_missing' #{RAILS_ROOT}/app/views/classified/show.rhtml:17:in

Request Parameters: {"id"=>"19"}

Show session dump

Has the classifieds table got a column updated_at? Show us the bit of db/schema.rb for that table if you think it has.

Post the start of classified.rb showing the class definition and any other stuff before the methods (if any).


I have these tables on my database with these fields each one:



This is what I have in the followings files:

I presume you just typed that and have mistyped. That is why I asked for schema.rb. Copy/paste in order to avoid typos.

What happens if you run the rails console and do c = Classified.first Does it show update_at


If "updated_at" was a column you manually specified, I recommend you rename it. That name is used automagically by Rails behind the scenes, so using it manually is asking for trouble. That and created_at are the timestamps added to any generated migration that creates a new table.

Or are you actually trying to use the automagic one? The details were "tl;dr", but if you really need, I can slog through them....