Class: NameFamily

Inherits:
Sequel::Model
  • Object
show all
Includes:
ASModel, AgentNames, AutoGenerator
Defined in:
backend/app/model/name_family.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from AutoGenerator

included, #update_from_json

Methods included from AgentNames

#before_validation, included, #update_from_json

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, 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_repository, strict_mode, strict_mode?, with_repository

Class Method Details

+ (Object) type_specific_hash_fields



26
27
28
# File 'backend/app/model/name_family.rb', line 26

def self.type_specific_hash_fields
  %w(family_name prefix qualifier)
end

Instance Method Details

- (Object) validate



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'backend/app/model/name_family.rb', line 8

def validate
  if authorized
    validates_unique([:authorized, :agent_family_id],
                     :message => "An agent can only have one authorized name")
    map_validation_to_json_property([:authorized, :agent_family_id], :authorized)
  end

  if is_display_name
    validates_unique([:is_display_name, :agent_family_id],
                     :message => "An agent can only have one display name")
    map_validation_to_json_property([:is_display_name, :agent_family_id], :is_display_name)
  end


  super
end