2014-11-06 14:46:59 +01:00
|
|
|
class User < ActiveRecord::Base
|
2014-11-06 18:30:53 +01:00
|
|
|
after_initialize :init
|
|
|
|
|
|
|
|
validates :name, presence: true, length: { maximum: 50 },
|
|
|
|
uniqueness: true
|
|
|
|
|
|
|
|
def init
|
|
|
|
self.marks ||= 0
|
|
|
|
self.role ||= "user"
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2014-11-06 14:46:59 +01:00
|
|
|
end
|