mercredi 6 novembre 2013

undefined method `body=' for "":String for Controller


Building a new controller for my web-app, I stucked on the following problem:

undefined method `body=' for "":String
Rails.root: /User/user/repo/project
Application Trace | Framework Trace | Full Trace
app/controllers/ctrl_controller.rb:9:in `callback
I had the following code:
class CtrlController < ActionController::Base
  def callback
    render :nothing => true
  end
end

Problem was just that the method name callbacl in a ActionController:Base is reserved!

Changing by 'create' solved the problem
class CtrlController < ActionController::Base
  def callback
    render :nothing => true
  end
end