This project is archived and is in readonly mode.

#2522 ✓resolved
Dmitry V

method_missing in controller should receive symbol instead of string

Reported by Dmitry V | April 19th, 2009 @ 03:12 PM | in 3.0.2

class ApplicationController
  def method_missing(method, *args)
    if something
      # ...
    else
      super
    end
  end
end

When I am trying to access unknown action, I am getting ArgumentError exception, which confuses me.

It is because method_missing in controller has behaviour different than in Ruby. (in ruby, method missing always receives name of called method as a symbol, not as string)

After applying patch, NameError exception will be raised in given controller, which is more meaningful than ArgumentError

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages