Class: Components::CollectionSelectInputRow
- Inherits:
-
SelectInputRow
- Object
- SelectInputRow
- Components::CollectionSelectInputRow
- Defined in:
- app/components/collection_select_input_row.rb
Instance Method Summary collapse
- #before_template ⇒ Object
-
#initialize(form:, attribute:, label:, collection:, text_method:, help:, value_method: :id, options: {}) ⇒ CollectionSelectInputRow
constructor
A new instance of CollectionSelectInputRow.
Constructor Details
#initialize(form:, attribute:, label:, collection:, text_method:, help:, value_method: :id, options: {}) ⇒ CollectionSelectInputRow
Returns a new instance of CollectionSelectInputRow.
4 5 6 7 8 9 |
# File 'app/components/collection_select_input_row.rb', line 4 def initialize(form:, attribute:, label:, collection:, text_method:, help:, value_method: :id, options: {}) @collection = collection @value_method = value_method @text_method = text_method super(form: form, attribute: "#{attribute}_#{value_method}", label: label, select_options: [], help: help, options: ) end |
Instance Method Details
#before_template ⇒ Object
11 12 13 |
# File 'app/components/collection_select_input_row.rb', line 11 def before_template @select_options = (@collection, @value_method, @text_method, @form&.object&.send(@attribute)) end |