Class: DataDictionarySet

Inherits:
ApplicationRecord show all
Includes:
Models::Auditable
Defined in:
app/models/data_dictionary_set.rb

Overview

== Schema Information

Table name: data_dictionary_sets
Database name: primary

id :integer not null, primary key
default_set :boolean
destination :string(255)
set_name :string(255)

Constant Summary

Constants included from Models::Auditable

Models::Auditable::ALWAYS_IGNORED

Has many collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Models::Auditable

#all_skipped_columns, #audit_reference_data, #creator, #should_not_save_version, #stamp_record, #updater

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Class Method Details

.destination_options_for_selectObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'app/models/data_dictionary_set.rb', line 24

def self.destination_options_for_select
  [
    "customer.company_name",
    "customer.first_name",
    "customer.middle_name",
    "customer.last_name",
    "customer.profile_id",
    "customer.primary_sales_rep_id",
    "customer.buying_group_id",
    "customer.affiliations",
    "billing_address.street1",
    "billing_address.street2",
    "billing_address.city",
    "billing_address.state_code",
    "billing_address.zip",
    "billing_address.country_iso3",
    "customer.phone",
    "customer.fax",
    "customer.email",
    "customer.website",
    "contact.title",
    "contact.first_name",
    "contact.middle_name",
    "contact.last_name",
    "contact.full_name",
    "notes"
  ]
end

.options_for_selectObject



53
54
55
# File 'app/models/data_dictionary_set.rb', line 53

def self.options_for_select
  all.order("set_name,destination").map{|o| [o.set_name,o.id]}
end

Instance Method Details

#data_dictionariesActiveRecord::Relation<DataDictionary>

Returns:

See Also:



16
# File 'app/models/data_dictionary_set.rb', line 16

has_many :data_dictionaries

#data_import_columnActiveRecord::Relation<DataImportColumn>

Returns:

See Also:



15
# File 'app/models/data_dictionary_set.rb', line 15

has_many :data_import_column

#options_for_destinationObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'app/models/data_dictionary_set.rb', line 57

def options_for_destination
  options = case destination
  when 'billing_address.country_iso3'
    Country.countries_for_select
  when 'customer.profile_id'
    Profile.options_for_select
  when 'customer.primary_sales_rep_id'
    Employee.sales_rep_options_for_select
  when 'customer.buying_group_id'
    BuyingGroup.options_for_select
  when 'customer.tier2_program_pricing_id'
    Coupon.tier2_select_options
  end
  options
end