Class: WineDataElement
- Inherits:
-
Object
- Object
- WineDataElement
- Includes:
- ActiveModel::ForbiddenAttributesProtection, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- app/models/wine_data_element.rb
Instance Method Summary collapse
- #get_values_for(attr) ⇒ Object
- #set_values!(appelations, production_areas, wine_colors, grapes, tasting_profiles, climates) ⇒ Object
Instance Method Details
#get_values_for(attr) ⇒ Object
25 26 27 |
# File 'app/models/wine_data_element.rb', line 25 def get_values_for(attr) (self.read_attribute(attr) || []).join(',') end |
#set_values!(appelations, production_areas, wine_colors, grapes, tasting_profiles, climates) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/models/wine_data_element.rb', line 15 def set_values!(appelations, production_areas, wine_colors, grapes, tasting_profiles, climates) set_values_for(:appelations, appelations) set_values_for(:production_areas, production_areas) self.wine_colors = wine_colors self.climates = climates self.tasting_profiles = tasting_profiles self.grapes = grapes self.save end |