Class: EacRailsUtils::CommonFormHelper::FormBuilder::AssociationSelectField
- Inherits:
-
Object
- Object
- EacRailsUtils::CommonFormHelper::FormBuilder::AssociationSelectField
- Defined in:
- app/helpers/eac_rails_utils/common_form_helper/form_builder/association_select_field.rb
Instance Method Summary collapse
- #collection ⇒ Object
- #foreign_key ⇒ Object
- #methods ⇒ Object
- #output ⇒ Object
- #select_options ⇒ Object
Instance Method Details
#collection ⇒ Object
13 14 15 16 17 |
# File 'app/helpers/eac_rails_utils/common_form_helper/form_builder/association_select_field.rb', line 13 def collection extract_association_key(:collection, *( ::Rails.version < '5' ? [:all] : %i[klass all] )) end |
#foreign_key ⇒ Object
19 20 21 22 23 |
# File 'app/helpers/eac_rails_utils/common_form_helper/form_builder/association_select_field.rb', line 19 def foreign_key extract_association_key(:foreign_key, ( ::Rails.version < '5' ? :association_foreign_key : :join_foreign_key )) end |
#methods ⇒ Object
25 26 27 |
# File 'app/helpers/eac_rails_utils/common_form_helper/form_builder/association_select_field.rb', line 25 def methods extract_methods() end |
#output ⇒ Object
29 30 31 32 33 34 |
# File 'app/helpers/eac_rails_utils/common_form_helper/form_builder/association_select_field.rb', line 29 def output builder.send(:field, field_name, ) do builder.form.collection_select(foreign_key, collection, methods[:value], methods[:text], , class: 'form-control') end end |
#select_options ⇒ Object
36 37 38 |
# File 'app/helpers/eac_rails_utils/common_form_helper/form_builder/association_select_field.rb', line 36 def () end |