Sha256: 211972f2dfb9950aee771a44a3ab503ae53d94caf1c2a194ceacacc40ff02254

Contents?: true

Size: 778 Bytes

Versions: 1

Compression:

Stored size: 778 Bytes

Contents

module ActionView
  module Helpers
    module FormHelper
      alias_method :original_text_field, :text_field
      def text_field(object_name, method, options = {})
        original_text_field(object_name, method, rename_autocomplete_option(options))
      end
    end

    module FormTagHelper
      alias_method :original_text_field_tag, :text_field_tag
      def text_field_tag(name, value = nil, options = {})
        original_text_field_tag(name, value, rename_autocomplete_option(options))
      end
    end

    #
    # Method used to rename the autocomplete key to a more standard
    # data-autocomplete key
    #
    private
    def rename_autocomplete_option(options)
      options["data-autocomplete"] = options.delete(:autocomplete)
      options
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails3-jquery-autocomplete-0.3.0 lib/form_helper.rb