Class: Dhatu::PromotionAttribute
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Dhatu::PromotionAttribute
- Includes:
- Publishable
- Defined in:
- app/models/dhatu/promotion_attribute.rb
Constant Summary collapse
- DATA_TYPES =
Data Type could be text, integer, date, list_drop_down (Select from a List), list_radio_button (Choose one) & boolean (Checkbox)
{"Text" => "text", "Integer" => "integer", "Date" => "date", "List (Drop Down)" => "list_drop_down", "List (Radio Button)" => "list_radio_button", "Boolean (Checkbox)" => "boolean"}
- DATA_TYPES_REVERSE =
{"text" => "Text", "integer" => "Integer", "date" => "Date", "list_drop_down" => "List (Drop Down)", "list_radio_button" => "List (Radio Button)", "boolean" => "Boolean (Checkbox)"}
Instance Attribute Summary collapse
-
#values_string ⇒ Object
Returns the value of attribute values_string.
Instance Method Summary collapse
- #can_be_deleted? ⇒ Boolean
-
#can_be_edited? ⇒ Boolean
Permission Methods ——————.
- #convert_string_values_to_array ⇒ Object
- #display_data_type ⇒ Object
-
#display_name ⇒ Object
Other Methods ——————.
- #set_string_values ⇒ Object
Instance Attribute Details
#values_string ⇒ Object
Returns the value of attribute values_string.
9 10 11 |
# File 'app/models/dhatu/promotion_attribute.rb', line 9 def values_string @values_string end |
Instance Method Details
#can_be_deleted? ⇒ Boolean
58 59 60 |
# File 'app/models/dhatu/promotion_attribute.rb', line 58 def can_be_deleted? true end |
#can_be_edited? ⇒ Boolean
Permission Methods
54 55 56 |
# File 'app/models/dhatu/promotion_attribute.rb', line 54 def can_be_edited? true end |
#convert_string_values_to_array ⇒ Object
43 44 45 |
# File 'app/models/dhatu/promotion_attribute.rb', line 43 def convert_string_values_to_array self.values = self.values_string.split(",") if self.values_string end |
#display_data_type ⇒ Object
39 40 41 |
# File 'app/models/dhatu/promotion_attribute.rb', line 39 def display_data_type DATA_TYPES_REVERSE[self.data_type] end |
#display_name ⇒ Object
Other Methods
35 36 37 |
# File 'app/models/dhatu/promotion_attribute.rb', line 35 def display_name self.name end |
#set_string_values ⇒ Object
47 48 49 |
# File 'app/models/dhatu/promotion_attribute.rb', line 47 def set_string_values self.values_string = self.values.join(",") if ["list_drop_down", "list_radio_button", ""].include?(self.data_type.to_s) end |