# Similar controller::layout functionality

**URL:** <https://www.ruby-forum.com/t/similar-controller-layout-functionality/184763>\
**Category:** Rails\
**Created:** [March 8, 2010, 9:02am UTC](https://www.ruby-forum.com/t/similar-controller-layout-functionality/184763 "2010-03-08T09:02:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/94ad74/32.png) [@anler](https://www.ruby-forum.com/u/anler)\
**Post date:** [March 8, 2010, 9:02am UTC](https://www.ruby-forum.com/t/similar-controller-layout-functionality/184763/1 "2010-03-08T09:02:05Z")

</div>

hi folks, I need help with something, I got a controller and I want be  
able to use a class method defined in ApplicationController as I do  
with (let say) the ‘layout’ function  
I’m new in Rails and Ruby but I know enough CakePHP to be aware of the  
conventions a stuff like that

The way I’m doing it is creating a class method in  
ApplicationController called authorize

#…ApplicationController  
def self.authorized what = []  
end  
#…

and trying to do the following in (let say, BlogController)  
#…BlogController  
layout ‘public’

authorize :all

def index  
end  
#…

but I’m getting this error:

undefined method `authorize’ for #BlogController:0x23322bc

someone knows the right way of doing this?

thanks

---

<div class="post-metadata">

**Author:** ![anler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/94ad74/32.png) [@anler](https://www.ruby-forum.com/u/anler)\
**Post date:** [March 8, 2010, 10:07am UTC](https://www.ruby-forum.com/t/similar-controller-layout-functionality/184763/2 "2010-03-08T10:07:38Z")

</div>

## forget it guys, it was a before\_filter :authorize that I forgot to eliminate ^^ thanks

anl
