Class: Flexite::ArrEntry
- Defined in:
- app/models/flexite/arr_entry.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from WithHistory
Class Method Details
.form(attributes = {}) ⇒ Object
17 18 19 |
# File 'app/models/flexite/arr_entry.rb', line 17 def self.form(attributes = {}) Entry::ArrayForm.new(attributes) end |
.service(type) ⇒ Object
21 22 23 |
# File 'app/models/flexite/arr_entry.rb', line 21 def self.service(type) "arr_entry_#{type}".to_sym end |
Instance Method Details
#entry=(entry) ⇒ Object
9 10 11 |
# File 'app/models/flexite/arr_entry.rb', line 9 def entry=(entry) entries << entry end |
#form_attributes ⇒ Object
13 14 15 |
# File 'app/models/flexite/arr_entry.rb', line 13 def form_attributes attributes.merge(entries: form_entries) end |
#t_node ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/models/flexite/arr_entry.rb', line 25 def t_node node = super.except('value') if entries.any? node.merge!('entries' => entries.map(&:t_node)) end node end |
#value ⇒ Object
5 6 7 |
# File 'app/models/flexite/arr_entry.rb', line 5 def value entries.select([:id, :value, :type]).map(&:value) end |