简体   繁体   中英

When writing a gem, how do you get access to helpers?

For a gem, i'm writing, I want to be able to access current_user (most auth systems have this helper)

What are some ways of doing that?

the thing that the controller includes to get current_user is this AuthenticatedSystem not sure how the helpers get access to it's contents

*I'm using RestfulAuth

If your gem has modules that get included on controllers, you can test if the method is available:

self.respond_to?( :current_user )

And if it is just call it. If your gem really needs it it would even raise an error if the method is not available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM