Class: NcsNavigator::Mdes::Variable
- Inherits:
-
Object
- Object
- NcsNavigator::Mdes::Variable
- Defined in:
- lib/ncs_navigator/warehouse/table_modeler/mdes_ext.rb
Instance Method Summary collapse
- #wh_manual_validations ⇒ Object
- #wh_property_options(in_table) ⇒ Object
- #wh_reference_name(in_table) ⇒ Object
Instance Method Details
#wh_manual_validations ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/ncs_navigator/warehouse/table_modeler/mdes_ext.rb', line 72 def wh_manual_validations [ # Other combinations of length restrictions are handled with # autovalidations if type.min_length && !type.max_length "validates_length_of :#{name}, :minimum => #{type.min_length}" end ].compact end |
#wh_property_options(in_table) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ncs_navigator/warehouse/table_modeler/mdes_ext.rb', line 58 def (in_table) @wh_property_options ||= begin = OrderedHash.new if in_table.wh_keys.include?(self) [:key] = true end [:required] = true if required [:omittable] = true if omittable [:pii] = pii unless pii.blank? .merge(type.) end end |
#wh_reference_name(in_table) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/ncs_navigator/warehouse/table_modeler/mdes_ext.rb', line 82 def wh_reference_name(in_table) fail 'Does not apply' unless self.table_reference if self.name =~ /_id$/ possible = self.name.sub(/_id$/, '') if in_table.variables.detect { |other_v| other_v.name == possible } "#{possible}_record" else possible end else self.name + '_record' end end |