Forum: Ruby on Rails Authorization plugin: unsetting roles?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2007-03-18 00:26
(Received via mailing list)
Hi there

I'm using the Authorization plugin but am having trouble unsetting

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

A User belongs_to :survey and is acts_as_authorized_user and

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

>> s =
=> #<Survey...

>> u =
=> #<User...

>> u.is_target_of s
=> [#<Role...]

>> s.has_targets?
=> true

>> s.has_targets.size
=> 1

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

=> 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.
This topic is locked and can not be replied to.