infoarts-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Mar-17 22:24 UTC
Authorization plugin: unsetting roles?
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: <pre>>> s = Survey.new=> #<Survey...>> u = User.new=> #<User...>> u.is_target_of s=> [#<Role...]>> 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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---