Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9527: README.txt

File README.txt, 0.7 kB (added by MarsuBoss, 1 year ago)
Line 
1 Example:
2
3   # Controller
4   class BlogController < ApplicationController
5     auto_complete_for :post, :title
6   end
7
8   # View
9   <%= text_field_with_auto_complete :post, 'title' %>
10
11 By default, auto_complete_for limits the results to 10 entries,
12 and sorts by the given field.
13
14 auto_complete_for takes a third parameter, an options hash to
15 the find method used to search for the records:
16
17   auto_complete_for :post, :title, :limit => 15, :order => 'created_at DESC'
18
19 For more examples, see script.aculo.us:
20 * http://script.aculo.us/demos/ajax/autocompleter
21 * http://script.aculo.us/demos/ajax/autocompleter_customized
22
23 Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license