Module: ActionView::Helpers::FormHelper
- Defined in:
- lib/rails-jquery-autocomplete/form_helper.rb
Instance Method Summary collapse
-
#autocomplete_field(object_name, method, source, options = {}) ⇒ Object
Returns an input tag of the “text” type tailored for accessing a specified attribute (identified by
method
) and that is populated with jQuery’s autocomplete plugin.
Instance Method Details
#autocomplete_field(object_name, method, source, options = {}) ⇒ Object
Returns an input tag of the “text” type tailored for accessing a specified attribute (identified by method
) and that is populated with jQuery’s autocomplete plugin.
Examples
autocomplete_field(:post, :title, , :size => 20)
# => <input type="text" id="post_title" name="post[title]" size="20" value="#{@post.title}" data-autocomplete="author/autocomplete"/>
11 12 13 14 |
# File 'lib/rails-jquery-autocomplete/form_helper.rb', line 11 def autocomplete_field(object_name, method, source, ={}) ["data-autocomplete"] = source text_field(object_name, method, rewrite_autocomplete_option()) end |