I''m trying to get a list of the methods that I''ve defined in a controller. But, "controller.methods" is giving me ALL the methods of the controller. Is there a way to get the only the methods that I''ve defined? Cheers -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Luke :> I''m trying to get a list of the methods that I''ve defined in a > controller. But, > > "controller.methods" is giving me ALL the methods of the controller. Is > there a way to get the only the methods that I''ve defined?ActionController::Base.action_methods and ActionController::Base#action_methods give you a set of your actions. If you want the public methods defined just in your controller, you''ve got MyController.public_instance_methods(false) HTH, -- Jean-François. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
action_methods returns an array, and you can subtract one array from another. so to get just the actions for that controller, you could do this in script/console: MyController.action_methods - ApplicationController.action_methods On Nov 26, 1:00 am, "Jean-François Trân" <jft...-HujFcYLiWL6M4zKIHC2jIg@public.gmane.org> wrote:> Luke : > > > I''m trying to get a list of the methods that I''ve defined in a > > controller. But, > > > "controller.methods" is giving me ALL the methods of the controller. Is > > there a way to get the only the methods that I''ve defined? > > ActionController::Base.action_methods and > ActionController::Base#action_methods give you a set > of your actions. > > If you want the public methods defined just in your controller, you''ve > got MyController.public_instance_methods(false) > > HTH, > > -- Jean-François.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> MyController.public_instance_methods(false)Awesome, worked like a charm. Thanks. -- 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-/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 -~----------~----~----~----~------~----~------~--~---