Class: LocationProfile

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



27
28
29
30
31
32
33
34
35
# File 'backend/app/model/location_profile.rb', line 27

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



18
19
20
21
22
23
24
# File 'backend/app/model/location_profile.rb', line 18

def display_string
  if depth && width && height
    return "#{name} [#{depth}d, #{height}h, #{width}w #{I18n.t("enumerations.dimension_units.#{dimension_units}", :default => "")}]"
  end

  name
end

#validateObject



12
13
14
15
# File 'backend/app/model/location_profile.rb', line 12

def validate
  super
  validates_unique(:name, :message => "location profile name not unique")
end