Hi, I am using a method_missing method into a controller. I have a route that says: match '':controller/:action'' What surprise me is that if a view that match the action name exists method_missing is not invoked but rails happily render the view. I was expecting that method_missing was going to be invoked if declarated. Is that a normal behaviour? Thanks Andrea -- 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.
On May 11, 2:54 pm, andreacfm <acampolon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I am using a method_missing method into a controller. > I have a route that says: > > match '':controller/:action'' > > What surprise me is that if a view that match the action name exists > method_missing is not invoked but rails happily render the view. > I was expecting that method_missing was going to be invoked if > declarated. > > Is that a normal behaviour? >Yes - you don''t need an empty method body if all you want to do is render a template (although you might consider it more readable code if there was an empty method body) Fred -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks. Was is not clear is why the method_missing method is not invoked if I declare it. Looks like rails render the view if exists before checking if a method_missing exists in the controller. Andrea On May 11, 5:12 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On May 11, 2:54 pm, andreacfm <acampolon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, > > > I am using a method_missing method into a controller. > > I have a route that says: > > > match '':controller/:action'' > > > What surprise me is that if a view that match the action name exists > > method_missing is not invoked but rails happily render the view. > > I was expecting that method_missing was going to be invoked if > > declarated. > > > Is that a normal behaviour? > > Yes - you don''t need an empty method body if all you want to do is > render a template (although you might consider it more readable code > if there was an empty method body) > > Fred-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.