# Extensions, Controllers and Inheritance

**URL:** <https://www.ruby-forum.com/t/extensions-controllers-and-inheritance/137652>\
**Category:** Radiant CMS\
**Created:** [May 15, 2008, 12:55am UTC](https://www.ruby-forum.com/t/extensions-controllers-and-inheritance/137652 "2008-05-15T00:55:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [May 15, 2008, 12:55am UTC](https://www.ruby-forum.com/t/extensions-controllers-and-inheritance/137652/1 "2008-05-15T00:55:07Z")

</div>

This is probably more of a ruby question than radiant but here goes…

I have two controllers in my extension that I’d love to inherit access  
rules (only\_allow\_access\_to) since they share the same rules.

Basically, I’d like to put:  
only\_allow\_access\_to :index, :new, :edit, :remove,  
:when =\> [:developer, :admin],  
:denied\_url =\> { :controller =\> ‘page’, :action =\> ‘index’ },  
:denied\_message =\> ‘You must have developer or admin privileges to  
perform this action.’

in my parent controller class and have the two child classes inherit it.  
The only\_allow\_access\_to method is added as a part of radiant’s  
lib/login\_system.rb and the method call in the parent doesn’t seem to  
inherit. Any clever way to do this?

This isn’t a major show stopper as I can just stick the rules into the  
two child classes – but finding a way to make this work has become sort  
of a mission at this point 🙂

-Chris
