Sha256: e206520774030b450576bf547abafbe63a42aa4171b8370142d120a5fafaf970
Contents?: true
Size: 504 Bytes
Versions: 3
Compression:
Stored size: 504 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 admin! update_attribute(:admin, true) 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ucb_rails-0.0.4 | app/models/ucb_rails/user.rb |
ucb_rails-0.0.3 | app/models/ucb_rails/user.rb |
ucb_rails-0.0.2 | app/models/ucb_rails/user.rb |