Make second user admin

This commit is contained in:
Stella Rouzi 2014-08-30 12:12:27 +03:00 committed by Stella
parent 4df9fa0fdb
commit 2e7169ede7

View file

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