I''m looking to find a way to access the data inside "@controller". i.e. when you have @controller.inspect you will see a list of all data in them. Are there anyway to do this? My real aim is to get the name of the action automatically. --~--~---------~--~----~------------~-------~--~----~ 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Parama wrote:> I''m looking to find a way to access the data inside "@controller". > i.e. when you have @controller.inspect you will see a list of all data > in them. > > Are there anyway to do this? > > My real aim is to get the name of the action automatically.if you have a class controller such as ExampleController you can access it by accessing it, really. ruby-render this (the ExampleController class will need to exist obviously): ExampleController.methods.join('' , '') ...and if you want it in a variable @controller, assign it. @controller = ExampleController and then, @controller.methods.inspect hth -- Posted via 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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org
2007-Jun-18 10:45 UTC
Re: Accessing a controller variable?
Hi -- On Sun, 17 Jun 2007, Parama wrote:> > I''m looking to find a way to access the data inside "@controller". > i.e. when you have @controller.inspect you will see a list of all data > in them. > > Are there anyway to do this? > > My real aim is to get the name of the action automatically.Have a look at the docs for ActionController::Base. There''s an attribute action_name, and various other methods for extracting information. David -- * Books: RAILS ROUTING (new! safari.awprofessional.com/9780321509246) RUBY FOR RAILS (manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (rubypal.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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks David. it works On Jun 18, 5:45 am, dbl...-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org wrote:> Hi -- > > On Sun, 17 Jun 2007, Parama wrote: > > > I''m looking to find a way to access the data inside "@controller". > > i.e. when you have @controller.inspect you will see a list of all data > > in them. > > > Are there anyway to do this? > > > My real aim is to get the name of the action automatically. > > Have a look at the docs for ActionController::Base. There''s an > attribute action_name, and various other methods for extracting > information. > > David > > -- > * Books: > RAILS ROUTING (new!safari.awprofessional.com/9780321509246) > RUBY FOR RAILS (manning.com/black) > * Ruby/Rails training > & consulting: Ruby Power and Light, LLC (rubypal.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 groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---