I am porting a Rails 2.3.8 app (ruby 1.8.7 (2010-01-10 patchlevel 249)
[i386-mingw32]) to Rails 3.1.1 Ruby 1.9.2p290
In the 2.4.8 app a method_missing is being called correctly. It’s a
ghost method.
In Rails 3.1.1 Ruby 1.9.2p290 the method_missing is not being called.
If I explicitly code a method for the missing method, the non-ghost
method does get called.
When I google
rails 3.1 method_missing
I see a handful of people have issues with method_missing … but the
errors don’t seem to be relevant to what I’m doing.
Any ideas?
Ok, I solved this one.
Short answer: replace
def method_missing(undefined_name, *args)
with
def action_missing(undefined_name, *args)
in your controller
Longer answer:
I can’t find this documented anywhere but in the Rails source code.
See
vendor\bundle\ruby\1.9.1\gems\actionpack-3.1.2\lib\abstract_controller\base.rb
Can anyone tell me why they changed this behavior? Was there a reason
to break old code?
Oh, yeah, this is a Rails issue and not a Ruby one.
You just saved me after five hours of debugging! Thanks for posting your
solution! 
Jimmy