tap/app/models/user.rb
2014-11-06 18:30:53 +01:00

13 lines
224 B
Ruby

class User < ActiveRecord::Base
after_initialize :init
validates :name, presence: true, length: { maximum: 50 },
uniqueness: true
def init
self.marks ||= 0
self.role ||= "user"
end
end