Class: AttributeType
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- AttributeType
- Defined in:
- app/models/attribute_type.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find_by_iid_with_description(description) ⇒ Object
22 23 24 25 |
# File 'app/models/attribute_type.rb', line 22 def self.find_by_iid_with_description(description) iid = description.strip.underscore.gsub(/\s+/,"_") AttributeType.find_by_internal_identifier iid end |
Instance Method Details
#update_iid ⇒ Object
27 28 29 |
# File 'app/models/attribute_type.rb', line 27 def update_iid self.internal_identifier = self.description.strip.underscore.gsub(/\s+/,"_") end |
#values_by_date_range(start_date, end_date) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/attribute_type.rb', line 9 def values_by_date_range(start_date, end_date) raise "attribute_type does not have a data_type of Date" unless self.data_type == "Date" attribute_values = self.attribute_values attribute_values.each do |attribute_value| unless attribute_value.value_as_date >= start_date and attribute_value.value_as_date <= end_date attribute_values.delete(attribute_value) end end attribute_values end |