Undefined method `of' for Task:Class

Apologies for simple question.
I am getting the error…
undefined method `of’ for Task:Class

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1129:in
method_missing' #{RAILS_ROOT}/app/models/task.rb:4 #{RAILS_ROOT}/app/controllers/tasks_controller.rb:12:inlist’

This error occured while loading the following files:
task.rb

I cannot see this error mentioned in the mailing list and googling for
it fails too.

I have a simple model type…
class Task < ActiveRecord::Base
validates_presence of :name
end

defined in the file task.rb and a database table ‘tasks’ and a
scaffolding generated controller called ‘tasks_controller.rb’. The
index method of the controller has…

def list
@task_pages, @tasks = paginate :tasks, :per_page => 10
end

Thanks for any help/thoughts,
Stuart.

Hi –

On Fri, 10 Nov 2006, sbarlow wrote:

validates_presence of :name

That should be:

validates_presence_of :name

David


David A. Black | [email protected]
Author of “Ruby for Rails” [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB’s Weblog) [2] | Co-director, Ruby Central, Inc. [4]
[1] Ruby for Rails | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com | [4] http://www.rubycentral.org

:slight_smile: I am such a fool.
And thanks a million dollars (or even roublies)
Do you get questions like this often?

Hi –

On Fri, 10 Nov 2006, sbarlow wrote:

:slight_smile: I am such a fool.
And thanks a million dollars (or even roublies)

I’ll take any currency :slight_smile:

Do you get questions like this often?

Sure. And I ask them occasionally. It’s why “RTFM” and “just Google
it” aren’t the whole story.

David


David A. Black | [email protected]
Author of “Ruby for Rails” [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB’s Weblog) [2] | Co-director, Ruby Central, Inc. [4]
[1] Ruby for Rails | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com | [4] http://www.rubycentral.org