README.markdown in rails3-jquery-autocomplete-0.2.0 vs README.markdown in rails3-jquery-autocomplete-0.2.1

- old
+ new

@@ -1,8 +1,9 @@ # rails3-jquery-autocomplete -An easy way to use jQuery's autocomplete with Rails 3 +An easy way to use jQuery's autocomplete with Rails 3. You can find a [detailed example](http://github.com/crowdint/rails3-jquery-autocomplete-app) +on how to use this gem [here](http://github.com/crowdint/rails3-jquery-autocomplete-app). ## Before you start Make sure your project is using jQuery-ui with the autocomplete widget before you continue. @@ -37,16 +38,16 @@ ### Model Example Assuming you have a Brand model: - class Brand < ActiveRecord::Base - end + class Brand < ActiveRecord::Base + end - create_table :brand do |t| - t.column :name, :string - end + create_table :brand do |t| + t.column :name, :string + end ### Controller To set up the required action on your controller, all you have to do is call it with the class name and the method as in the following example: @@ -73,11 +74,11 @@ * Luna * Unacceptable * Rerun -#### :full => false +#### :full => false (default behavior) Only the following terms mould match the query 'un': * Unacceptable @@ -92,5 +93,33 @@ This will generate an HTML tag that looks like: <input type="text" 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' + +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 + +And then, install all your dependecies: + + bundle install + +### Running the test suite + + rake test + +# About the Author + +[Crowd Interactive](http://www.crowdint.com) is an American web design and development company that happens to work in Colima, Mexico. +We specialize in building and growing online retail stores. We don’t work with everyone – just companies we believe in. Call us today to see if there’s a fit. +Find more info [here](http://www.crowdint.com)! \ No newline at end of file