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


A

Abraham Vionas

------=_NextPart_000_00BF_01C4D01E.6770AB90
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

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'

------=_NextPart_000_00BF_01C4D01E.6770AB90--
 
Ad

Advertisements

A

Abraham Vionas

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:[email protected]]
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'
 
L

Lyndon Samson

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
 
C

Curt Hibbs

Lyndon said:
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
 
D

David Heinemeier Hansson

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

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
 
L

Lyndon Samson

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
 
Ad

Advertisements

J

Jamis Buck

Abraham said:
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
 
A

Abraham Vionas

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: (e-mail address removed) [mailto:[email protected]]
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 said:
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
 
L

Lester

Lyndon Samson said:
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
 
J

Jim Weirich

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.
 
A

Abraham Vionas

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:[email protected]]
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.
 
Ad

Advertisements

L

Laurent Julliard

Lester said:
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 :) Thanks
for the suggestion though.

Laurent[/QUOTE]
 

Top