Tuesday, September 8, 2009

NoMethodError, undefined method `call' for MyController:Class

If you're getting this error:
NoMethodError in MyController#my_action
undefined method `call' for ClientScriptsController:Class

...then you might have forgotten to make your controller inherit (extend) the ApplicationController class, like I did. The big clue is that the undefined method is in the class, not the instance.

Controllers should be set up like this:

class MyController < ApplicationController
def my_action
#do something...
end
end

No comments: