Class: Labimotion::SegmentKlass

Inherits:
ApplicationRecord
  • Object
show all
Includes:
GenericKlass, GenericKlassRevisions, MetadataValidation, Workflow
Defined in:
lib/labimotion/models/segment_klass.rb

Class Method Summary collapse

Methods included from Workflow

#migrate_workflow, #split_workflow

Methods included from GenericKlassRevisions

#check_identifier, #create_klasses_revision

Class Method Details

.gen_klasses_jsonObject



28
29
30
31
32
33
34
# File 'lib/labimotion/models/segment_klass.rb', line 28

def self.gen_klasses_json
  klasses = where(is_active: true)&.pluck(:name) || []
rescue ActiveRecord::StatementInvalid, PG::ConnectionBad, PG::UndefinedTable
  klasses = []
ensure
  Rails.root.join('config', 'segment_klass.json').write(klasses&.to_json || [])
end