# Authorization with single table inheritance?

**URL:** <https://www.ruby-forum.com/t/authorization-with-single-table-inheritance/92179>\
**Category:** Rails\
**Created:** [April 16, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/authorization-with-single-table-inheritance/92179 "2007-04-16T22:43:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Invincible\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/bc79bd/32.png) [@Invincible\_C](https://www.ruby-forum.com/u/Invincible_C)\
**Post date:** [April 16, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/authorization-with-single-table-inheritance/92179/1 "2007-04-16T22:43:37Z")

</div>

Hi,

I am trying to use Authorization plugin for providing access control for  
my  
application.Application has 2 types of users, admins and end-users both  
being maintained in a single table with calles users and with the helps  
of  
users and admins using STI.  
When I make my admin model “user-like” by including statement  
“acts\_as\_authorized\_user” and have something like " permit ‘admin’ " in  
any  
of the controller, it gives following error in development log,

“There is not table by name ROLES\_ADMINS”

Looks like authorization plugin just reads the class name and tries to  
find  
a table with roles\_#{class\_name}.

On a second attempt I tried including acts\_as\_authorized\_user in User  
model  
which is extended by Admin and EndUser Models…despite of having permit  
‘admin’ statement, Rails allows all the controller actions visible to  
all  
the users irrespective of their role ☹

Has anyone tried this before?

-Invincible

---

<div class="post-metadata">

**Author:** ![Invincible\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/bc79bd/32.png) [@Invincible\_C](https://www.ruby-forum.com/u/Invincible_C)\
**Post date:** [April 16, 2007, 11:36pm UTC](https://www.ruby-forum.com/t/authorization-with-single-table-inheritance/92179/2 "2007-04-16T23:36:49Z")

</div>

ok guys…thats was really a silly mistake…

In my User model I had following statemnt

def has\_role?(role,options)  
true  
end

-Invincible.
