Class: ActionView::Helpers::AttributeBuilders::Select
- Defined in:
- lib/actionview_attribute_builders/attribute_builders/select.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #html_attributes ⇒ Object
-
#initialize(object_name, method_name, template_object, options, html_options) ⇒ Select
constructor
A new instance of Select.
- #options ⇒ Object
Constructor Details
#initialize(object_name, method_name, template_object, options, html_options) ⇒ Select
Returns a new instance of Select.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/actionview_attribute_builders/attribute_builders/select.rb', line 7 def initialize(object_name, method_name, template_object, , ) = super(object_name, method_name, template_object, ) = .stringify_keys [:required, :multiple, :size].each do |prop| [prop.to_s] = .delete(prop) if .key?(prop) && !.key?(prop.to_s) end add_default_name_and_id() ["value"] = .fetch(:selected) { value() } end |
Instance Method Details
#html_attributes ⇒ Object
21 22 23 |
# File 'lib/actionview_attribute_builders/attribute_builders/select.rb', line 21 def html_attributes end |
#options ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/actionview_attribute_builders/attribute_builders/select.rb', line 25 def return unless placeholder_required?() raise ArgumentError, "include_blank cannot be false for a required field." if [:include_blank] == false [:include_blank] ||= true unless [:prompt] end |