Sha256: 1b25a2845d7ec61e45051b899d9032c87fbd0073ac9e5d51348f876fd5be0b6a
Contents?: true
Size: 945 Bytes
Versions: 5
Compression:
Stored size: 945 Bytes
Contents
module Facades::Builders module FormHelper ## # # Cusomizes the default form_for helper to add additional functionality # All params are the same as Rails' form_for # # @param [Mixed] record_name_or_array # @param [Array] args # @param [Block] &block # def form_for(record_name_or_array, *args, &proc) raise ArgumentError, "Missing block" unless block_given? options = args.extract_options! options.reverse_merge!(:builder => Facades::Builders::Form) options[:html] ||= {} options[:html].merge!('data-js-validatable' => true) if options.delete(:validate) default_proc = ::ActionView::Base.field_error_proc ::ActionView::Base.field_error_proc = lambda{ |html_tag, instance_tag| html_tag } super(record_name_or_array, *(args << options), &proc) ensure ::ActionView::Base.field_error_proc = default_proc end end end
Version data entries
5 entries across 5 versions & 1 rubygems