Module: PicoPhone::Rails::FormBuilderExtension
- Defined in:
- lib/pico_phone/rails/form_helper.rb
Overview
Included into ActionView::Helpers::FormBuilder by the railtie once
ActionView loads. Adds f.pico_phone_field, mirroring
PicoPhone::Rails::FormHelper#pico_phone_field_tag but bound to the form's object.
Instance Method Summary collapse
-
#pico_phone_field(method, region: nil, **options) ⇒ String
An HTML-safe
<input type="tel">tag.
Instance Method Details
#pico_phone_field(method, region: nil, **options) ⇒ String
Returns an HTML-safe <input type="tel"> tag.
63 64 65 66 67 |
# File 'lib/pico_phone/rails/form_helper.rb', line 63 def pico_phone_field(method, region: nil, **) resolved_region = PicoPhone::Rails.resolve_region(region, object) display_value = PicoPhone::Rails.phone_field_display_value(object.public_send(method), resolved_region) text_field(method, .merge(value: display_value, type: "tel")) end |