# Global method

**URL:** <https://www.ruby-forum.com/t/global-method/109407>\
**Category:** Rails\
**Created:** [July 14, 2007, 11:17am UTC](https://www.ruby-forum.com/t/global-method/109407 "2007-07-14T11:17:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [July 14, 2007, 11:17am UTC](https://www.ruby-forum.com/t/global-method/109407/1 "2007-07-14T11:17:45Z")

</div>

Hi all,

I want a authenticated? method that I can access in all my  
controllers. Where do I best put this method?

Thanks  
Stijn

---

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [July 14, 2007, 12:27pm UTC](https://www.ruby-forum.com/t/global-method/109407/2 "2007-07-14T12:27:50Z")

</div>

Hi –

On Sat, 14 Jul 2007, Tarscher wrote:

> Hi all,
> 
> I want a authenticated? method that I can access in all my  
> controllers. Where do I best put this method?

In application.rb, in the app/controllers directory. This file, which  
is created automatically for you, defines the ApplicationController  
class, which then serves as the superclass for all of your controller  
classes. So instance methods you define here will be available to all  
the controllers.

David

–

- Books:  
RAILS ROUTING (new! [http://www.awprofessional.com/title/0321509242](http://www.awprofessional.com/title/0321509242))  
RUBY FOR RAILS ([Ruby for Rails](http://www.manning.com/black))
- Ruby/Rails training  
& consulting: Ruby Power and Light, LLC ([http://www.rubypal.com](http://www.rubypal.com))
