Sha256: f8aca6109a5c2035ea494d6b02213130e84d5c4625dfdf84271bcc32d13049e4
Contents?: true
Size: 862 Bytes
Versions: 6
Compression:
Stored size: 862 Bytes
Contents
require 'bcrypt' module Ecm::UserArea class User < ActiveRecord::Base acts_as_authentic &Ecm::UserArea::Configuration.acts_as_authentic_options scope :autocomplete, ->(matcher) { where("LOWER(email) LIKE ?", "%#{matcher.downcase}%") } scope :authenticable, -> { where(active: true, confirmed: true, approved: true) } # def self.current_id=(id) # Thread.current[:user_id] = id # end # def self.current_id # Thread.current[:user_id] # end def as_json(options = {}) options.reverse_merge!(style: :default) style = options.delete(:style) case style when :autocomplete { value: id, title: human, subtitle: self.inspect } else super end end def authenticable? [active, confirmed, approved].all? end def human email end end end
Version data entries
6 entries across 6 versions & 1 rubygems