Class: FormProps::Inputs::GroupedCollectionSelect
- Inherits:
-
Base
- Object
- ActionView::Helpers::Tags::Base
- Base
- FormProps::Inputs::GroupedCollectionSelect
- Includes:
- ActionView::Helpers::FormOptionsHelper, ActionView::Helpers::Tags::SelectRenderer, FormOptionsHelper, SelectRenderer
- Defined in:
- lib/form_props/inputs/grouped_collection_select.rb
Instance Method Summary collapse
-
#initialize(object_name, method_name, template_object, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options) ⇒ GroupedCollectionSelect
constructor
A new instance of GroupedCollectionSelect.
- #render ⇒ Object
Methods included from SelectRenderer
#add_options, #select_content_props
Methods included from FormOptionsHelper
#extract_selected_and_disabled, #extract_values_from_collection, #grouped_options_for_select, #option_groups_from_collection_for_select, #option_html_attributes, #options_for_select, #options_from_collection_for_select, #selected_values, #time_zone_options_for_select, #value_for_collection, #weekday_options_for_select
Methods inherited from Base
Constructor Details
#initialize(object_name, method_name, template_object, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options) ⇒ GroupedCollectionSelect
Returns a new instance of GroupedCollectionSelect.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/form_props/inputs/grouped_collection_select.rb', line 13 def initialize(object_name, method_name, template_object, collection, group_method, group_label_method, option_key_method, option_value_method, , ) @collection = collection @group_method = group_method @group_label_method = group_label_method @option_key_method = option_key_method @option_value_method = option_value_method @html_options = super(object_name, method_name, template_object, ) end |
Instance Method Details
#render ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/form_props/inputs/grouped_collection_select.rb', line 24 def render = { selected: @options.fetch(:selected) { value }, disabled: @options[:disabled] } select_content_props( option_groups_from_collection_for_select(@collection, @group_method, @group_label_method, @option_key_method, @option_value_method, ), @options, @html_options ) end |