Sha256: af8b6116dcdb5764cb3682d4bb6dd7d0720b70b462715c8318d2ea34c2603115
Contents?: true
Size: 1005 Bytes
Versions: 1
Compression:
Stored size: 1005 Bytes
Contents
module LatoCore # This class is the model for superusers. class Superuser < ActiveRecord::Base # Validations ############################################################################ validates :name, presence: true, length: { maximum: 50 } validates :username, presence: true, length: { maximum: 50 }, uniqueness: { case_sensitive: false } validates :email, presence: true, length: { maximum: 255 }, format: { with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i }, uniqueness: { case_sensitive: false } validates :permission, presence: true, length: { minimum: 1, maximum: 10 } validates :password, presence: true, length: { minimum: 6, maximum: 50 }, on: :create has_secure_password # Before db update ############################################################################ before_create do username.downcase! email.downcase! end before_update do username.downcase! email.downcase! end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lato_core-1.1.5 | app/models/lato_core/superuser.rb |