Sha256: 8a651afb980930c2e931ba8e103b6286126decc085590b9030d654e8e098737b
Contents?: true
Size: 641 Bytes
Versions: 2
Compression:
Stored size: 641 Bytes
Contents
class UcbRails::User < ActiveRecord::Base self.table_name = 'users' attr_accessible :uid, :first_name, :last_name, :inactive before_validation :set_first_last_name def active? !inactive? end def admin!(_admin=true) update_attribute(:admin, _admin) end def inactive!(_inactive=true) update_attribute(:inactive, _inactive) end def self.active where(inactive: false) end def self.admin where(admin: true) end private def set_first_last_name self.first_last_name = [first_name, last_name] .select { |n| n.present? } .join(' ') .presence end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ucb_rails-0.0.6 | app/models/ucb_rails/user.rb |
ucb_rails-0.0.5 | app/models/ucb_rails/user.rb |