When I set up my controllers, I put some of them in a sub-directory under app/controllers. That works fine. My problem is that the helpers are also placed in a sub-directory of the same name. I can''t seem to figure out how to access the helper belonging to one of the controllers in the sub-directory. For example, the directory hierarchy looks like this. ./app/controllers ./app/controllers/foo ./app/controllers/foo/my_controller.rb ./app/helpers ./app/helpers/foo ./app/helpers/foo/my_controller_helper.rb How can I set up an include (I assume) so the controller can find its helper? Or do I have to move the helper methods into a shared higher- level helper? Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2007-Nov-01 15:27 UTC
Re: A question about accessing a controller''s helper
On 1 Nov 2007, at 15:07, awhayes wrote:> > ./app/controllers > ./app/controllers/foo > ./app/controllers/foo/my_controller.rb > ./app/helpers > ./app/helpers/foo > ./app/helpers/foo/my_controller_helper.rb > > How can I set up an include (I assume) so the controller can find its > helper? Or do I have to move the helper methods into a shared higher- > level helper?IIRC for this to work, my_controller_helper.rb should define module Foo::MyControllerHelper Fred
Thanks, Fred. After I posted the question, I tried ''include Foo::MyControllerHelper'' and it seemed to work fine. On Nov 1, 11:27 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 1 Nov 2007, at 15:07, awhayes wrote: > > > > > ./app/controllers > > ./app/controllers/foo > > ./app/controllers/foo/my_controller.rb > > ./app/helpers > > ./app/helpers/foo > > ./app/helpers/foo/my_controller_helper.rb > > > How can I set up an include (I assume) so the controller can find its > > helper? Or do I have to move the helper methods into a shared higher- > > level helper? > > IIRC for this to work, my_controller_helper.rb should define module > Foo::MyControllerHelper > > Fred > > smime.p7s > 5KDownload--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---