Created
June 27, 2014 19:04
-
-
Save barce/4c7775c1fde0436eb24f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Role to delete: viewer | |
# get role | |
role = Role.find_by_name('viewer') | |
# get user | |
user = User.find_by_email('foo@example.com') | |
# delete role by looping through role assignments | |
user.role_assignments.each do |ra| | |
ra.destroy! if ra.role_id == role.id | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment