Forum: Ruby N00b request help with scaffold- undefined method 'body=' er

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
na (Guest)
on 2006-02-26 04:36
(Received via mailing list)
Hey guys,

I'm trying to work my way through the Ruby on Rails tutorial building
CRUD actions using scaffold based on a single database table.

the "list" action seems to work well, but all other actions result in

See trace below ..

I am only 2 hours into my Ruby (rails) experience and I have no idea how
to track down this bug.

Here's the top part of my ResponseController code:

class ResponsesController < ApplicationController
   def index
     render :action => 'list'

   def list
     @response_pages, @responses = paginate :responses, :per_page => 10

   def show
     @response = Response.find(params[:id])

   def new
     @response =

Any help appreciated!


undefined method `body=' for #<Response:0xb756fed8>

RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace

/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'
Hampton (Guest)
on 2006-02-26 17:59
(Received via mailing list)
If I had this error, I'd guess that I don't have the attribute "body"
in my "responses" table. Though, I don't know the particulars of your
setup, so it could be many things.

However, please note that scaffolding is not the preferred way to learn
Rails. And, secondly, there is a rails dedicated group that is probably
a better place for rails questions.

But, anyhow, goodluck with it!

Guillaume Benny (Guest)
on 2006-02-26 18:24
(Received via mailing list)
>    end


 My guess is that "response" is something special in Rails (so is
if I remember correctly). You are probably overwriting a Rails instance
variable... Try renaming @response to something else. It might even be
"Response" model that's confusing Rails: maybe there is a Response class
Rails. Try renaming it to something else...

 I hope this will help...

Jeff McNeil (Guest)
on 2006-02-26 18:42
(Received via mailing list)
Shouldn't you also be inheriting from ActionController and not
ApplicationController?  Have a look at the ActionController class
I've always thought that ApplicationController was a top-level abstract?


(Oh, hi! I don't post much, but I enjoy reading what everyone else
does =)
na (Guest)
on 2006-02-26 19:44
(Received via mailing list)
Thanks, Guillaume.

This was the problem.  I renamed my controller and things started
working as they were designed.

This topic is locked and can not be replied to.