Sha256: c8ad1ed6885528294ab66b2e2dc9c21b9ad15ead53530b5c8819d73127a679e1

Contents?: true

Size: 561 Bytes

Versions: 5

Compression:

Stored size: 561 Bytes

Contents

module Ecom
  module Model
    class User < ApplicationRecord
      has_secure_password

      has_and_belongs_to_many :user_roles, join_table: 'ecom_model_users_user_roles'

      VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i.freeze
      validates :first_name, :last_name, :active, presence: true
      validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false }
      validates :password, length: { minimum: 6 }

      def full_name
        "#{first_name} #{last_name}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ecom_model-2.0.4 app/models/ecom/model/user.rb
ecom_model-2.0.3 app/models/ecom/model/user.rb
ecom_model-2.0.2 app/models/ecom/model/user.rb
ecom_model-2.0.1 app/models/ecom/model/user.rb
ecom_model-2.0.0 app/models/ecom/model/user.rb