I found this code inside
vendor/plugins/auto_complete/lib/auto_complete.rb . Could this be used ?
> module ClassMethods
> def auto_complete_for(object, method, options = {})
> define_method("auto_complete_for_#{object}_#{method}") do
> find_options = {
> :conditions => [ "LOWER(#{method}) LIKE ?", '%' +
> params[object[method].downcase + '%' ],
> :order => "#{method} ASC",
> :limit => 10 }.merge!(options)
>
> @items = object.to_s.camelize.constantize.find(:all, find_options)
>
> render :inline => "<%= auto_complete_result @items, '#{method}' %>"
> end
> end
> end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---