unknown attribute: authorizable

13 views
Skip to first unread message

Ivan

unread,
Oct 9, 2009, 6:30:14 PM10/9/09
to acl9-discuss
I received de error bellow when I try to set role do a user

==> current_user.has_role!(:owner, @company) <==

I followed the tutorials and haven't seen in any place I had to create
a 'authorizable' attribute, neither in Roles or um Roles_Users. I
created authorizable_type and authorizable_id attributes in Roles.

What have I done wrong ???



Role Load (0.2ms) SELECT * FROM `roles` WHERE (name = 'owner' and
authorizable_type = 'Company' and authorizable_id = 9) LIMIT 1
Role Columns (0.7ms) SHOW FIELDS FROM `roles`

ActiveRecord::UnknownAttributeError (unknown attribute: authorizable):
vendor/gems/be9-acl9-0.11.0/lib/acl9/model_extensions/subject.rb:
63:in `has_role!'
app/controllers/companies_controller.rb:48:in `create'
app/controllers/companies_controller.rb:46:in `create'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendered rescues/_trace (57.6ms)
Rendered rescues/_request_and_response (1.9ms)
Rendering rescues/layout (internal_server_error)

oleg dashevskii

unread,
Oct 10, 2009, 1:26:53 AM10/10/09
to acl9-d...@googlegroups.com
Double-check acts_as_authorization_role call in Role class and acts_as_authorization_object inside Company.

2009/10/10 Ivan <ihsch...@gmail.com>



--
Олег.

Ivan

unread,
Oct 10, 2009, 7:20:44 AM10/10/09
to acl9-discuss
I should kill myself ... slowly, painfully, ...
I changed role.rb file to do some tests and forgot about it.

Thank you very much for your help.

Ivan

On 10 out, 02:26, oleg dashevskii <olegdashevs...@gmail.com> wrote:
> Double-check acts_as_authorization_role call in Role class and
> acts_as_authorization_object inside Company.
>
> 2009/10/10 Ivan <ihschus...@gmail.com>
Reply all
Reply to author
Forward
0 new messages