Class: ExtractStatus
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ExtractStatus
- Defined in:
- app/models/extract_status.rb
Class Method Summary collapse
- .const_missing(name) ⇒ Object
- .define_consts ⇒ Object
- .dump_all ⇒ Object
- .status_definitions ⇒ Object
Class Method Details
.const_missing(name) ⇒ Object
31 32 33 |
# File 'app/models/extract_status.rb', line 31 def self.const_missing(name) name.downcase.to_s end |
.define_consts ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/models/extract_status.rb', line 11 def self.define_consts @@status_definitions = [] @@status_definitions = status_definitions = StatusDefinition.where({}) status_definitions.each { |status_definition| status = status_definition.status unless status.nil? status = status.downcase self.const_set status.upcase, status scope status, -> {where(:status => status)} else raise "Your database maybe in an unknown state; ExtractStatus' status is nil" end } end |
.dump_all ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/models/extract_status.rb', line 39 def self.dump_all { self.to_s.underscore.pluralize => self.where(["status <> 'building_request'"]).map{|es| unless es.extract_request.user_id.nil? { 'extract_request_id' => es.extract_request.uuid, 'status' => es.status } end }.reject{|x| x.nil? } } end |
.status_definitions ⇒ Object
35 36 37 |
# File 'app/models/extract_status.rb', line 35 def self.status_definitions @@status_definitions end |