Class: LocationProfile
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- LocationProfile
- Includes:
- ASModel
- Defined in:
- backend/app/model/location_profile.rb
Constant Summary
Constants included from JSONModel
JSONModel::REFERENCE_KEY_REGEX
Class Method Summary collapse
Instance Method Summary collapse
Methods included from ASModel
all_models, included, update_publish_flag, update_suppressed_flag
Methods included from JSONModel
JSONModel, #JSONModel, add_error_handler, all, allow_unmapped_enum_value, backend_url, check_valid_refs, client_mode?, custom_validations, destroy_model, enum_default_value, enum_values, handle_error, init, load_schema, #models, models, parse_jsonmodel_ref, parse_reference, repository, repository_for, schema_src, set_publish_flags!, set_repository, strict_mode, strict_mode?, validate_schema, with_repository
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_string ⇒ Object
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 |
#validate ⇒ Object
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 |