learningtapestry/lcms-engine

View on GitHub
app/models/lcms/engine/access_code.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

module Lcms
  module Engine
    class AccessCode < ApplicationRecord
      validates :code, presence: true, uniqueness: true

      scope :active, -> { where(active: true) }
      scope :by_code, ->(value) { active.where('lower(code) = ?', value.downcase) }
    end
  end
end