Module: ActionView::Helpers::FormHelper
- Defined in:
- lib/rails3-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. - #original_text_field ⇒ Object
- #text_field(object_name, method, options = {}) ⇒ Object
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"/>
16 17 18 19 |
# File 'lib/rails3-jquery-autocomplete/form_helper.rb', line 16 def autocomplete_field(object_name, method, source, ={}) [:autocomplete] = source text_field(object_name, method, ) end |
#original_text_field ⇒ Object
4 |
# File 'lib/rails3-jquery-autocomplete/form_helper.rb', line 4 alias_method :original_text_field, :text_field |
#text_field(object_name, method, options = {}) ⇒ Object
5 6 7 |
# File 'lib/rails3-jquery-autocomplete/form_helper.rb', line 5 def text_field(object_name, method, = {}) original_text_field(object_name, method, rename_autocomplete_option()) end |