Module: ValidationSyncFormHelper
- Defined in:
- app/helpers/validation_sync_form_helper.rb
Instance Method Summary collapse
-
#form_for(record, options = {}, &block) ⇒ Object
Override the default form_for method to include a data-sync-validations attribute, set to true / false returns html.
Instance Method Details
#form_for(record, options = {}, &block) ⇒ Object
Override the default form_for method to include a data-sync-validations attribute, set to true / false returns html
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/validation_sync_form_helper.rb', line 9 def form_for(record, = {}, &block) # If the html_options / data hashes are not # set, then let's add them as empty hashes [:html] ||= {} [:html][:data] ||= {} # Default to validate = false [:validate] ||= false # Add our data-sync-validations attribute [:html][:data][:sync_validations] = [:validate].to_s # Let the Rails defaults take it from here super end |