Class: Formatic::Select
- Inherits:
-
Base
- Object
- ViewComponent::Base
- ApplicationComponent
- Base
- Formatic::Select
- Defined in:
- app/components/formatic/select.rb
Overview
Dropdown box
Instance Method Summary collapse
Methods inherited from Base
#input_name, #param_key, #value, #wrapper
Methods inherited from ApplicationComponent
Constructor Details
This class inherits a constructor from Formatic::ApplicationComponent
Instance Method Details
#choices ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/components/formatic/select.rb', line 27 def choices ::Formatic::Choices.call( f:, attribute_name:, options:, records:, keys:, include_current:, include_blank: include_blank? ) end |
#current_choice_name ⇒ Object
39 40 41 |
# File 'app/components/formatic/select.rb', line 39 def current_choice_name choices.detect { it.last == value }&.first end |
#include_blank? ⇒ Boolean
43 44 45 46 47 |
# File 'app/components/formatic/select.rb', line 43 def include_blank? return wrapper.optional? if @include_blank == :guess !!@include_blank end |