Class: Effective::TableRows::Collection
- Inherits:
-
Effective::TableRow
- Object
- Effective::TableRow
- Effective::TableRows::Collection
- Defined in:
- app/models/effective/table_rows/collection.rb
Instance Attribute Summary
Attributes inherited from Effective::TableRow
#builder, #name, #options, #template
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(name, collection, options, builder:) ⇒ Collection
constructor
A new instance of Collection.
Methods inherited from Effective::TableRow
#controller_namespace, #hint, #label, #label_content, #to_html, #value
Constructor Details
#initialize(name, collection, options, builder:) ⇒ Collection
Returns a new instance of Collection.
7 8 9 10 |
# File 'app/models/effective/table_rows/collection.rb', line 7 def initialize(name, collection, , builder:) @collection = collection super(name, , builder: builder) end |
Instance Method Details
#content ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/models/effective/table_rows/collection.rb', line 12 def content values = Array(value) - [nil, ''] if values.length > 1 values.map { |v| content_tag(:div, v) }.join.html_safe elsif values.length == 1 values.first end end |