Starting companies and admin
This commit is contained in:
27
app/models/user.rb
Normal file
27
app/models/user.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
class User < ApplicationRecord
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||
has_and_belongs_to_many :companies
|
||||
devise :database_authenticatable,
|
||||
:recoverable, :rememberable, :validatable
|
||||
|
||||
def admin?
|
||||
true if self.role == 1000
|
||||
end
|
||||
|
||||
def user?
|
||||
true if self.role == 100
|
||||
end
|
||||
|
||||
def roletxt
|
||||
role = "undefined"
|
||||
if self.role == 1000
|
||||
role = "Admin"
|
||||
end
|
||||
|
||||
if self.role == 100
|
||||
role = "User"
|
||||
end
|
||||
role
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user