Sha256: 9b4d15440b0a543d2c336be3528723f2e7797573f65abbb6ff2f13aee9ed1bdb
Contents?: true
Size: 575 Bytes
Versions: 8
Compression:
Stored size: 575 Bytes
Contents
# frozen_string_literal: true module Spree class ReturnReason < Spree::Base scope :active, -> { where(active: true) } default_scope -> { order(arel_table[:name].lower) } validates :name, presence: true, uniqueness: { case_sensitive: false, allow_blank: true } has_many :return_authorizations self.allowed_ransackable_attributes = %w[name] def self.reasons_for_return_items(return_items) # Only allow an inactive reason if it's already associated to a return item active | return_items.map(&:return_reason).compact end end end
Version data entries
8 entries across 8 versions & 1 rubygems