move sample user creation in seeds

This commit is contained in:
Stella Rouzi 2014-08-01 18:27:22 +03:00
parent 59fe90a706
commit 3bb42bdb10
3 changed files with 13 additions and 12 deletions

View file

@ -50,6 +50,7 @@ class User < ActiveRecord::Base
def setup_role
self.is_admin = true if User.count == 0
roles << Role.where(name: 'Admin') if User.count == 1
end
# Gets the roles of the user, groups them by role.name and returns the resource(s) of each role