Sha256: e1bfc4ebd1008affdd702df21969e94edf536bd3081be08b2c5eb24acadb47a2

Contents?: true

Size: 802 Bytes

Versions: 11

Compression:

Stored size: 802 Bytes

Contents

unless PluginRoutes.static_system_info['user_model'].present?
  module CamaleonCms
    class User < CamaleonRecord
      include CamaleonCms::UserMethods

      self.table_name = PluginRoutes.static_system_info['cama_users_db_table'] || "#{PluginRoutes.static_system_info['db_prefix']}users"

      default_scope { order(role: :asc) }

      validates :username, presence: true
      validates :email, presence: true, format: { with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i } # , :unless => Proc.new { |a| a.auth_social.present? }
      has_secure_password

      def self.find_by_email(email)
        where(['lower(email) = ?', email.to_s.downcase]).take
      end

      def self.find_by_username(username)
        where(['lower(username) = ?', username.to_s.downcase]).take
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
camaleon_cms-2.9.0 app/models/camaleon_cms/user.rb
camaleon_cms-2.8.3 app/models/camaleon_cms/user.rb
camaleon_cms-2.8.2 app/models/camaleon_cms/user.rb
camaleon_cms-2.8.1 app/models/camaleon_cms/user.rb
camaleon_cms-2.8.0 app/models/camaleon_cms/user.rb
camaleon_cms-2.7.5 app/models/camaleon_cms/user.rb
camaleon_cms-2.7.4 app/models/camaleon_cms/user.rb
camaleon_cms-2.7.3 app/models/camaleon_cms/user.rb
camaleon_cms-2.7.2 app/models/camaleon_cms/user.rb
camaleon_cms-2.7.1 app/models/camaleon_cms/user.rb
camaleon_cms-2.7.0 app/models/camaleon_cms/user.rb