Ralph Shnelvar
2011-Dec-26 00:55 UTC
method_missing not working in RoR 3.1.1 & Ruby 1.9.2p290?
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ralph Shnelvar
2011-Dec-26 10:40 UTC
Re: method_missing not working in RoR 3.1.1 & Ruby 1.9.2p290?
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ralph Shnelvar
2011-Dec-26 13:49 UTC
Re: method_missing not working in RoR 3.1.1 & Ruby 1.9.2p290?
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jimmy Zong
2013-Aug-15 22:40 UTC
Re: method_missing not working in RoR 3.1.1 & Ruby 1.9.2p290?
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.