Forum: Ruby on Rails namespace helpers

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Franz O. (Guest)
on 2008-10-30 05:44
(Received via mailing list)
I have two people_controller and people_helper.  One in the controller
and helper directory and the other in the controller/admin and helper/
admin namespace.  The reason I have two controllers is because I want
different views and functionality based on wether the user is an admin
or not.  I know how to distinguish calling the controllers, but I
don't know how to distinguish the helpers.  To include the people
helper I use;

helper :people

How do I include the helper in the admin directory?
Franz O. (Guest)
on 2008-10-30 06:08
(Received via mailing list)
By the way, is there a difference between;

helper :people

and

include PeopleHelper

??
Thani A. (Guest)
on 2008-10-30 06:12
Franz Obenhauser wrote:
> I have two people_controller and people_helper.  One in the controller
> and helper directory and the other in the controller/admin and helper/
> admin namespace.  The reason I have two controllers is because I want
> different views and functionality based on wether the user is an admin
> or not.  I know how to distinguish calling the controllers,

i couldn't understand you question
what you told that
"I know how to distinguish calling the controllers"

if you can then how ?

> but I don't know how to distinguish the helpers.  To include the people
> helper I use;
>
> helper :people
> How do I include the helper in the admin directory?

try this
helper 'admin/people'
or
helper 'admin::people'
Thani A. (Guest)
on 2008-10-30 06:19
Franz Obenhauser wrote:
> By the way, is there a difference between;
>
> helper :people
>
> and
>
> include PeopleHelper
>
> ??
yes  -- both are different

first one do both ruby magic require & include
second one do include only
Franz O. (Guest)
on 2008-10-30 07:06
(Received via mailing list)
> try this
> helper 'admin/people'
> or
> helper 'admin::people'


That's it.  Thanks a lot.
This topic is locked and can not be replied to.