Class: Field
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Field
- Defined in:
- app/models/field.rb
Constant Summary collapse
- @@field_config =
{ 'hidden' => [], 'read_only' => [], 'text_field' => [], 'email_field' => [], 'number_field' => [], 'date_field' => ['format'], 'text_area' => [], 'boolean' => [], 'enum' => ['enum_values'], 'paperclip_field' => [], 'belongs_to' => ['target_display_column'], 'has_many' => ['target_model', 'target_section_id'] }
Class Method Summary collapse
-
.field_types ⇒ Object
returns array of possible field types.
- .valid_options ⇒ Object
Instance Method Summary collapse
Class Method Details
.field_types ⇒ Object
returns array of possible field types
36 37 38 |
# File 'app/models/field.rb', line 36 def self.field_types @@field_config.keys end |
.valid_options ⇒ Object
44 45 46 47 48 49 50 |
# File 'app/models/field.rb', line 44 def self. = [] @@field_config.each_value do |val| .concat(val) end return end |
Instance Method Details
#option_fields ⇒ Object
40 41 42 |
# File 'app/models/field.rb', line 40 def option_fields self.field_type.blank? || !@@field_config.has_key?(self.field_type) ? [] : @@field_config[self.field_type] end |
#overview_link ⇒ Object
53 54 55 56 57 |
# File 'app/models/field.rb', line 53 def overview_link return false if self..blank? is_link = self.[:overview_link] object_to_boolean(is_link) end |
#overview_link=(is_link) ⇒ Object
59 60 61 62 |
# File 'app/models/field.rb', line 59 def overview_link=(is_link) self. = Hash.new if self..blank? self.[:overview_link] = object_to_boolean(is_link) end |