25 lines
764 B
Ruby
25 lines
764 B
Ruby
class User < ActiveRecord::Base
|
|
include Gravtastic
|
|
|
|
belongs_to :role
|
|
|
|
gravtastic :size => 165, :filetype => :png, :rating => 'R'
|
|
|
|
# Include default devise modules. Others available are:
|
|
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
|
|
devise :database_authenticatable, :registerable,
|
|
:recoverable, :rememberable, :trackable, :validatable
|
|
|
|
validates :username, :presence => true, :uniqueness => true
|
|
|
|
# Setup accessible (or protected) attributes for your model
|
|
attr_accessible :username, :email, :password, :password_confirmation, :remember_me, :is_admin
|
|
|
|
has_many :topics, :dependent => :destroy
|
|
has_many :posts, :dependent => :destroy
|
|
|
|
def admin?
|
|
self.is_admin
|
|
end
|
|
end
|