# Authorization plugin: unsetting roles?

**URL:** <https://www.ruby-forum.com/t/authorization-plugin-unsetting-roles/89164>\
**Category:** Rails\
**Created:** [March 17, 2007, 11:26pm UTC](https://www.ruby-forum.com/t/authorization-plugin-unsetting-roles/89164 "2007-03-17T23:26:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 17, 2007, 11:26pm UTC](https://www.ruby-forum.com/t/authorization-plugin-unsetting-roles/89164/1 "2007-03-17T23:26:11Z")

</div>

Hi there

I’m using the Authorization plugin but am having trouble unsetting  
roles.

I’m off and running with it using it on top of acts\_as\_authenticated  
but am having trouble unsetting roles once I’ve set them.

A Survey has\_many :users, :dependent =\> :delete\_all and is  
acts\_as\_authorizable

A User belongs\_to :survey and is acts\_as\_authorized\_user and  
acts\_as\_authorizable

In the console, this is what I am playing with:

```
>> s = Survey.new
=> #> u = User.new
=> #> u.is_target_of s
=> [#> s.has_targets?
=> true

>> s.has_targets.size
=> 1

>> s.has_targets[0].id
=> 2

>> u.id
=> 2 # so survey target is set properly

# Now to unset the role

>> u.is_not_target_of s
=> nil

>> u.has_no_role 'target', s
=> nil

# target still exists!
>> s.has_targets.size
=> 1

So I'm confused why I can set the 'target' role for @survey but can't
unset the same way?

Any clues would be appreciated.
```
