README.markdown in rails3-jquery-autocomplete-0.3.0 vs README.markdown in rails3-jquery-autocomplete-0.3.1
- old
+ new
@@ -114,31 +114,31 @@
### View
On your view, all you have to do is include the attribute autocomplete on the text field
using the url to the autocomplete action as the value.
form_for @product do |f|
- f.text_field :brand_name, :autocomplete => autocomplete_brand_name_products_path
+ f.autocomplete_field :brand_name, autocomplete_brand_name_products_path
end
This will generate an HTML tag that looks like:
- <input type="text" autocomplete="products/autocomplete_brand_name">
+ <input type="text" data-autocomplete="products/autocomplete_brand_name">
Now your autocomplete JS code is unobtrusive, Rails 3 style.
### Getting the object id
If you need to use the id of the selected object, you can use the *:id_element* HTML tag too:
- f.text_field :brand_name, :autocomplete => autocomplete_brand_name_products_path, :id_element => '#some_element'
+ f.autocomplete_field :brand_name, autocomplete_brand_name_products_path, :id_element => '#some_element'
This will update the field with id *#some_element with the id of the selected object. The value for this option can be any jQuery selector.
## Development
If you want to make changes to the gem, first install bundler 1.0.0:
- gem install bundler --pre
+ gem install bundler
And then, install all your dependencies:
bundle install
\ No newline at end of file