You Cannot Name a Controller Action ’send’ in Merb

I learned this the hard way.

  class Main < Application
 
    def send
      # Do some stuff...
    end
 
  end

This breaks horribly, even if you’re not navigating to that exact controller action.

~ Request: /favicon.ico
~ Request: 
~ Params: {"action"=>"index", "controller"=>"main"}
~ Routed to: {:action=>"index", :controller=>"main"}
~ wrong number of arguments (1 for 0) - (ArgumentError) 
/opt/local/lib/ruby/gems/1.8/gems/merb-core-0.9.1/lib/merb-core/controller/abstract_controller.rb:229:in `send'

Call it something else.

I should add this has something to do with Object#send and the hackery that goes on in Merb. I’m sure it could be patched somehow, but I’m being lazy.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*