Some progress but have hit a new error working through the Todo tutorial... Anyone recognize it?

The error is below. Ugh. But at least it works up to this point. I don't
know enough Ruby or Rails to know what it is having problems with. Can
anyone else assist me with this? I'm running XP, Ruby 1.8.2RC3, Rails 0.8.5.

NoMethodError in Todo#index

undefined method `scaffold' for #<TodoController:0x2a276b8>

app/controllers/todo_controller.rb:18:in `index'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:577:in `send'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:577:in `perform_action_without_filters'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/fil
ters.rb:236:in `perform_action_without_benchmark'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/ben
chmarking.rb:30:in `perform_action_without_rescue'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/ben
chmarking.rb:30:in `measure'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/ben
chmarking.rb:30:in `perform_action_without_rescue'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/res
cue.rb:68:in `perform_action'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:254:in `process'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:242:in `process'

C:/cs/ruby/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/dispatcher.rb:35:in
`dispatch'

Oh, whups. The state of the todo_controller.rb file that evokes this error
is:

require 'abstract_application'
require 'todo'

class TodoController < AbstractApplicationController
  helper :todo

def index
  scaffold:todo
end
end

···

-----Original Message-----
From: Abraham Vionas [mailto:abe_ml@bozemantechmedic.com]
Sent: Sunday, November 21, 2004 11:04 PM
To: ruby-talk ML
Subject: Some progress but have hit a new error working through the Todo
tutorial... Anyone recognize it?

The error is below. Ugh. But at least it works up to this point. I don't
know enough Ruby or Rails to know what it is having problems with. Can
anyone else assist me with this? I'm running XP, Ruby 1.8.2RC3, Rails 0.8.5.

NoMethodError in Todo#index

undefined method `scaffold' for #<TodoController:0x2a276b8>

app/controllers/todo_controller.rb:18:in `index'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:577:in `send'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:577:in `perform_action_without_filters'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/fil
ters.rb:236:in `perform_action_without_benchmark'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/ben
chmarking.rb:30:in `perform_action_without_rescue'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/ben
chmarking.rb:30:in `measure'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/ben
chmarking.rb:30:in `perform_action_without_rescue'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/res
cue.rb:68:in `perform_action'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:254:in `process'

C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:242:in `process'

C:/cs/ruby/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/dispatcher.rb:35:in
`dispatch'

Firstly, I'd like to say, a great IDE for a great language!

There is one smallish problem I've experienced.

When 'running' a program, STDOUT seems to be buffered, and the program
does not exit after all the user code has finished executing.

If I hit stop, I see the output, and the run exits.

Has this been seen before?

cheers
lyndon

Oh, whups. The state of the todo_controller.rb file that evokes this error
is:

require 'abstract_application'
require 'todo'

class TodoController < AbstractApplicationController
  helper :todo

def index
  scaffold:todo
end

This needs to be:

class TodoController < AbstractApplicationController
   helper :todo
   scaffold :todo
end

You don't want the scaffold macro inside the index action.

Also, I recommend using the Rails mailing list for questions like these. Hundreds of Rails programmers are hanging out there ready to help.

http://lists.rubyonrails.org/mailman/listinfo/rails

···

--
David Heinemeier Hansson,
http://www.basecamphq.com/ -- Web-based Project Management
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://macromates.com/ -- TextMate: Code and markup editor (OS X)
http://www.loudthinking.com/ -- Broadcasting Brain

Abraham Vionas wrote:

Oh, whups. The state of the todo_controller.rb file that evokes this error
is:

require 'abstract_application'
require 'todo'

class TodoController < AbstractApplicationController
  helper :todo

def index
  scaffold:todo
end end

Declare the scaffolding outside of the method, at the class level, like this:

   class TodoController < AbstractApplicationController

     helper :todo
     scaffold :todo

     def index
       ...
     end

   end

Good luck!

- Jamis

···

--
Jamis Buck
jgb3@email.byu.edu
http://www.jamisbuck.org/jamis

Lyndon Samson wrote:

Firstly, I'd like to say, a great IDE for a great language!

There is one smallish problem I've experienced.

When 'running' a program, STDOUT seems to be buffered, and the program
does not exit after all the user code has finished executing.

If I hit stop, I see the output, and the run exits.

Has this been seen before?

Are you running on Windows? There is a problem like this on windows which is
being actively investigated (no solution yet, however).

Curt

Thanks for the help Jamis!

So, I modified my code to appear like so...

···

----------
require 'abstract_application'
require 'todo'

class TodoController < AbstractApplicationController
  helper :todo
  scaffold :todo

  def index
   render_text("Text")
  end
  
end
----------

And while it doesn't throw any errors it also doesn't provide the answer the
tutorial indicates I should be expecting. It says I should expect to see a
screen like:

--------------
LISTING TODOS

Description Done

New todo
--------------

The tutorial suggests removing the "render_text" line and replacing it with
the scaffold line, but obviously that creates an error for me... But so does
removing the "render_text" line and leaving it empty while moving "scaffold:
todo" to immediately beneath "helper: todo".

-----Original Message-----
From: jgb3@email.byu.edu [mailto:jgb3@email.byu.edu]
Sent: Monday, November 22, 2004 7:14 AM
To: ruby-talk ML
Subject: Re: Some progress but have hit a new error working through the Todo
tutorial... Anyone recognize it?

Abraham Vionas wrote:

Oh, whups. The state of the todo_controller.rb file that evokes this
error
is:

require 'abstract_application'
require 'todo'

class TodoController < AbstractApplicationController
  helper :todo

def index
  scaffold:todo
end
end

Declare the scaffolding outside of the method, at the class level, like
this:

   class TodoController < AbstractApplicationController

     helper :todo
     scaffold :todo

     def index
       ...
     end

   end

Good luck!

- Jamis

--
Jamis Buck
jgb3@email.byu.edu
http://www.jamisbuck.org/jamis

Lyndon Samson <lyndon.samson@gmail.com> wrote in message news:<a39f6ad004112122185326306@mail.gmail.com>...

Firstly, I'd like to say, a great IDE for a great language!

There is one smallish problem I've experienced.

When 'running' a program, STDOUT seems to be buffered, and the program
does not exit after all the user code has finished executing.

If I hit stop, I see the output, and the run exits.

Has this been seen before?

cheers
lyndon

Try " STDOUT.sync = true " at the top of the script - works with RDE

Are you running on Windows? There is a problem like this on windows which is
being actively investigated (no solution yet, however).

Yup, thanks for the headsup

Abraham Vionas said:

Thanks for the help Jamis!

So, I modified my code to appear like so...

----------
require 'abstract_application'
require 'todo'

class TodoController < AbstractApplicationController
  helper :todo
  scaffold :todo

  def index
   render_text("Text")
  end

end
----------

[...]

The tutorial suggests removing the "render_text" line and replacing it
with the scaffold line, but obviously that creates an error for me...

[...]

Try completely removing the entire index method. You are overriding the
index method from the scaffolding.

···

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

Lester wrote:

Try " STDOUT.sync = true " at the top of the script - works with RDE

I wish it was that simple but it's not where the problem is :slight_smile: Thanks for the suggestion though.

Laurent

···

--
Laurent JULLIARD - Xerox R&T/SSTC/XPA - Open Source team
>> Host your Xerox Software project on CodeX: http://codex.xerox.com
>> Linux@Xerox community: http://xww.linux.world.xerox.com

Removing it evokes:

···

------
TypeError in Todo#index

superclass mismatch for class ParseError

C:/cs/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.2.1/lib/postgres-pr/message.
rb:9
C:/cs/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in
`require__'
C:/cs/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in
`require'
C:/cs/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.2.1/lib/postgres-pr/connecti
on.rb:6
C:/cs/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in
`require__'
C:/cs/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in
`require'
C:/cs/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.2.1/lib/postgres.rb:7
C:/cs/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in
`require__'
C:/cs/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in
`require'
C:/cs/ruby/lib/ruby/gems/1.8/gems/activerecord-1.1.0/lib/active_record/conne
ction_adapters/abstract_adapter.rb:10:in `require_library_or_gem'
C:/cs/ruby/lib/ruby/gems/1.8/gems/activerecord-1.1.0/lib/active_record/conne
ction_adapters/postgresql_adapter.rb:20:in `postgresql_connection'
C:/cs/ruby/lib/ruby/gems/1.8/gems/activerecord-1.1.0/lib/active_record/conne
ction_adapters/abstract_adapter.rb:140:in `send'
C:/cs/ruby/lib/ruby/gems/1.8/gems/activerecord-1.1.0/lib/active_record/conne
ction_adapters/abstract_adapter.rb:140:in `connection='
C:/cs/ruby/lib/ruby/gems/1.8/gems/activerecord-1.1.0/lib/active_record/conne
ction_adapters/abstract_adapter.rb:104:in `retrieve_connection'
C:/cs/ruby/lib/ruby/gems/1.8/gems/activerecord-1.1.0/lib/active_record/base.
rb:172:in `connection'
C:/cs/ruby/lib/ruby/gems/1.8/gems/activerecord-1.1.0/lib/active_record/base.
rb:276:in `find_by_sql'
C:/cs/ruby/lib/ruby/gems/1.8/gems/activerecord-1.1.0/lib/active_record/base.
rb:270:in `find_all'
C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/sca
ffolding.rb:103:in `list'
C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/sca
ffolding.rb:96:in `index'
C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:577:in `send'
C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:577:in `perform_action_without_filters'
C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/fil
ters.rb:236:in `perform_action_without_benchmark'
C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/ben
chmarking.rb:30:in `perform_action_without_rescue'
C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/ben
chmarking.rb:30:in `measure'
C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/ben
chmarking.rb:30:in `perform_action_without_rescue'
C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/res
cue.rb:68:in `perform_action'
C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:254:in `process'
C:/cs/ruby/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/bas
e.rb:242:in `process'
C:/cs/ruby/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/dispatcher.rb:35:in
`dispatch'
---------

...Which appears to be a DB connection problem? I know I can connect to my
PostgreSQL DB through postgres-pr (0.2.1), but perhaps I have to setup
different connection parameters for Rails? I'm not certain how to setup
Rails to connect to a PostgreSQL DB.

-----Original Message-----
From: Jim Weirich [mailto:jim@weirichhouse.org]
Sent: Monday, November 22, 2004 10:52 AM
To: ruby-talk ML
Subject: Re: Some progress but have hit a new error working through the Todo
tutorial... Anyone recognize it?

Abraham Vionas said:

Thanks for the help Jamis!

So, I modified my code to appear like so...

----------
require 'abstract_application'
require 'todo'

class TodoController < AbstractApplicationController
  helper :todo
  scaffold :todo

  def index
   render_text("Text")
  end

end
----------

[...]

The tutorial suggests removing the "render_text" line and replacing it
with the scaffold line, but obviously that creates an error for me...

[...]

Try completely removing the entire index method. You are overriding the
index method from the scaffolding.

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, not tried
it." -- Donald Knuth (in a memo to Peter van Emde Boas)