README.markdown in rails3-jquery-autocomplete-0.3.2 vs README.markdown in rails3-jquery-autocomplete-0.3.3
- old
+ new
@@ -18,11 +18,11 @@
## Installing
Include the gem on your Gemfile
- gem 'rails3-jquery-autocomplete', '0.3.1'
+ gem 'rails3-jquery-autocomplete', '0.3.2'
Install it
bundle install
@@ -113,18 +113,26 @@
### 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.autocomplete_field :brand_name, autocomplete_brand_name_products_path
end
This will generate an HTML tag that looks like:
<input type="text" data-autocomplete="products/autocomplete_brand_name">
-Now your autocomplete JS code is unobtrusive, Rails 3 style.
+If you are not using a FormBuilder (form_for) or you just want to include an autocomplete field without the form, you can use the
+*autocomplete_field_tag* helper.
+
+ form_tag 'some/path'
+ autocomplete_field_tag 'address', '', address_autocomplete_path, :size => 75
+ end
+
+Now your autocomplete 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:
\ No newline at end of file