Flowdock
method

auto_complete_for

Importance_0
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: ActionController::Macros::AutoComplete::ClassMethods

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1.2.6) is shown here.

auto_complete_for(object, method, options = {}) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_controller/macros/auto_complete.rb, line 38
        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
Register or log in to add new notes.