Making your Rails controllers respond

I was looking at Google Analytics today and found that the following searhes often end up here:

webrat no action responded to /. actions: index

and

"no action responded to" webrat

It’s good to see that people are trying out webrat, presumably with cucumber to test their apps.

The problem here is most likely that you need to add a method to your controller to handle the incoming request.  So if you are getting the message

no action responded to new

you would want to go to the controller that you are testing and add something like this:

1
2
3
def new
    #TODO make new do something
end

Don’t forget to add a view such as app/views/example/new.html.erb that corresponds to the action you just added to your controller.

Also, learn to find the TODO annotation again with rake.

Tags: , , ,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">