Class: Integral::ApplicationRecord

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/integral/application_record.rb

Overview

Base Integral Model.

Class Method Summary collapse

Class Method Details

.available_statuses(opts = { reverse: false }) ⇒ Array

Returns containing available human readable statuses against there numeric value.

Returns:

  • (Array)

    containing available human readable statuses against there numeric value



7
8
9
10
11
12
13
# File 'app/models/integral/application_record.rb', line 7

def self.available_statuses(opts = { reverse: false })
  available_statuses = statuses.map do |key, value|
    [I18n.t("integral.statuses.#{key}"), key]
  end

  opts[:reverse] ? available_statuses.each(&:reverse!) : available_statuses
end