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?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Ralph Shnelvar at Dec 26, 2011 at 10:41 am
    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?

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Jimmy Zong at Aug 18, 2013 at 9:18 am
    You just saved me after five hours of debugging! Thanks for posting your
    solution! :)

    Jimmy
    On Monday, December 26, 2011 5:40:39 AM UTC-5, Ruby-Forum.com User wrote:

    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?

    --
    Posted via http://www.ruby-forum.com/.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c69da364-44bd-4b86-9f1a-56315bc9006f%40googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Ralph Shnelvar at Dec 26, 2011 at 1:49 pm
    Oh, yeah, this is a Rails issue and not a Ruby one.

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 26, '11 at 12:55a
activeAug 18, '13 at 9:18a
posts4
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Ralph Shnelvar: 3 posts Jimmy Zong: 1 post

People

Translate

site design / logo © 2021 Grokbase