Sha256: 49c1fcdcc05723f4590462233bb508ab08f0a56ba42c62f34d94ad1710a4b947
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
class User < ActiveRecord::Base BRICK_POSTS_RELATION # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, BRICK_ALLOW_SIGNUP :recoverable, :rememberable, :trackable, :validatable, :confirmable # Pagination paginates_per 100 # Validations # :email validates_format_of :email, with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i def self.paged(page_number) order(admin: :desc, email: :asc).page page_number end def self.search_and_order(search, page_number) if search where("email LIKE ?", "%#{search.downcase}%").order( admin: :desc, email: :asc ).page page_number else order(admin: :desc, email: :asc).page page_number end end def self.last_signups(count) order(created_at: :desc).limit(count).select("id","email","created_at") end def self.last_signins(count) order(last_sign_in_at: :desc).limit(count).select("id","email","last_sign_in_at") end def self.users_count where("admin = ? AND locked = ?",false,false).count end end
Version data entries
3 entries across 3 versions & 2 rubygems