I would like to know the method that will be called from before_filter, is it possible? for example class TestController < ApplicationController before_filter :tell_method_name protected def tell_method_name #tell the name of the method that is going to be called end def index ... end end so if i call http://localhost:3000/test, it will call tell_method_name and display "index", how can i do it in here? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 14 Jan 2008, at 07:41, hsun wrote:> > I would like to know the method that will be called from > before_filter, is it possible? >You can use action_name to get the name of the current action. Fred> for example > > class TestController < ApplicationController > > before_filter :tell_method_name > > protected > def tell_method_name > #tell the name of the method that is going to be called > end > > def index > ... > end > > > end > > > so if i call http://localhost:3000/test, it will call tell_method_name > and display "index", how can i do it in here? > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you very much On Jan 14, 3:52 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 14 Jan 2008, at 07:41, hsun wrote: > > > > > I would like to know the method that will be called from > > before_filter, is it possible? > > You can use action_name to get the name of the current action. > > Fred > > > for example > > > class TestController < ApplicationController > > > before_filter :tell_method_name > > > protected > > def tell_method_name > > #tell the name of the method that is going to be called > > end > > > def index > > ... > > end > > > end > > > so if i callhttp://localhost:3000/test, it will call tell_method_name > > and display "index", how can i do it in here?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---