Created
July 26, 2010 20:14
-
-
Save jerodsanto/491166 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
admin = Role.create(:title => "admin") | |
mike = User.create(:name => "mike") | |
# either | |
mike.roles << admin | |
# or | |
mike.roles.push admin | |
# or you can also go the other way | |
admin.users << mike | |
# or | |
admin.users.push mike | |
# a quick way to create a bunch of roles | |
['admin', 'worker', 'client'].each do |title| | |
Role.create(:title => title) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment