Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

method_missing in controller should receive symbol instead of string

#2522
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

Reported by Dmitry V · April 19th, 2009 @ 03:12 PM

State: resolved
Milestone: 3.0.2
Assigned to: Yehuda Katz (wycats) Yehuda Katz (wycats)
Importance: none

Activity

  1. Dmitry V
    Dmitry V
    • Tag changed from 2.x, action_controller, method_missing, patch to 2.x, 3.0, action_controller, bug, method_missing, patch

    April 20th, 2009 @ 08:15 PM

  2. Dmitry V
    Dmitry V
    • Assigned user set to Yehuda Katz (wycats)

    MikeG1 said that this patch probably will not be applied in 2.3.x

    April 20th, 2009 @ 08:17 PM

  3. Rizwan Reza
    Rizwan Reza

    Patch doesn't apply anymore.

    January 18th, 2010 @ 01:56 PM

  4. Rizwan Reza
    Rizwan Reza
    • State changed from new to open
    • Milestone cleared.

    This doesn't apply anymore.

    It's probably a good idea to add test for this, which I have attached.

    March 26th, 2010 @ 01:01 PM

  5. Rizwan Reza
    Rizwan Reza
    • State changed from open to resolved

    March 27th, 2010 @ 07:26 AM

  6. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to

    October 15th, 2010 @ 11:01 PM