Created
March 15, 2012 04:06
-
-
Save bradylove/2041803 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| before_create :set_new_user_role | |
| def set_new_user_role | |
| if user is first user | |
| then user.role = admin_role_id | |
| user.save | |
| else | |
| user.role = default_role_id | |
| user.save | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment