Skip to content
Browse files

No need to create Role records for each user roles assignments.

  • Loading branch information...
1 parent d901dc5 commit de94b5d2b79ad05e9b9cea5c79efc9eb72492095 @huerlisi committed
Showing with 1 addition and 4 deletions.
  1. +1 −4 app/models/user.rb
View
5 app/models/user.rb
@@ -26,10 +26,7 @@ def role_texts
end
def role_texts=(role_names)
- roles.delete_all
- for role_name in role_names
- roles.build(:name => role_name)
- end
+ self.roles = Role.where(:name => role_names)
end
# Person

0 comments on commit de94b5d

Please sign in to comment.
Something went wrong with that request. Please try again.