Sha256: a1a7eee7bdf16ed2e1f393d4602431956d30ba601a6d84c8c797ccb8be06d596

Contents?: true

Size: 616 Bytes

Versions: 15

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true
#
# This is a CRUD model to populate the select field to choose qb_item_name on acts_as_purchasable objects.

module Effective
  class ItemName < ActiveRecord::Base
    self.table_name = (EffectiveOrders.item_names_table_name || :item_names).to_s

    acts_as_archived
    log_changes if respond_to?(:log_changes)

    effective_resource do
      name       :string
      archived   :boolean

      timestamps
    end

    scope :sorted, -> { order(:name) }

    validates :name, uniqueness: true, presence: true

    def to_s
      name.presence || model_name.human
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
effective_orders-6.22.0 app/models/effective/item_name.rb
effective_orders-6.21.4 app/models/effective/item_name.rb
effective_orders-6.21.3 app/models/effective/item_name.rb
effective_orders-6.21.2 app/models/effective/item_name.rb
effective_orders-6.21.1 app/models/effective/item_name.rb
effective_orders-6.21.0 app/models/effective/item_name.rb
effective_orders-6.20.0 app/models/effective/item_name.rb
effective_orders-6.19.7 app/models/effective/item_name.rb
effective_orders-6.19.6 app/models/effective/item_name.rb
effective_orders-6.19.5 app/models/effective/item_name.rb
effective_orders-6.19.4 app/models/effective/item_name.rb
effective_orders-6.19.3 app/models/effective/item_name.rb
effective_orders-6.19.2 app/models/effective/item_name.rb
effective_orders-6.19.1 app/models/effective/item_name.rb
effective_orders-6.19.0 app/models/effective/item_name.rb