Class: CustomReportTemplate

Inherits:
Sequel::Model
  • Object
show all
Defined in:
backend/app/model/custom_report_template.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.sequel_to_jsonmodel(objs, opts = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'backend/app/model/custom_report_template.rb', line 19

def self.sequel_to_jsonmodel(objs, opts = {})
  jsons = super

  jsons.zip(objs).each do |json, obj|
    json['display_string'] = obj.display_string
  end

  jsons
end

Instance Method Details

#display_stringObject



14
15
16
# File 'backend/app/model/custom_report_template.rb', line 14

def display_string
  name.to_s
end

#validateObject



7
8
9
10
11
# File 'backend/app/model/custom_report_template.rb', line 7

def validate
  super
  validates_unique(:name, :message => "custom report template name not unique")
  data_validation
end