Class: ActionView::Helpers::AttributeBuilders::SearchField

Inherits:
TextField
  • Object
show all
Defined in:
lib/actionview_attribute_builders/attribute_builders/search_field.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Base

#object

Instance Method Summary collapse

Methods inherited from TextField

field_type

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ActionView::Helpers::AttributeBuilders::Base

Instance Method Details

#html_attributesObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/actionview_attribute_builders/attribute_builders/search_field.rb', line 7

def html_attributes
  options = @options.stringify_keys

  if options["autosave"]
    if options["autosave"] == true
      options["autosave"] = request.host.split(".").reverse.join(".")
    end
    options["results"] ||= 10
  end

  if options["onsearch"]
    options["incremental"] = true unless options.has_key?("incremental")
  end

  @options = options
  super
end