Module: JqueryAutoComplete::ClassMethods
- Defined in:
- lib/jquery/jquery_auto_complete.rb
Instance Method Summary collapse
Instance Method Details
#auto_complete_for(object, method, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/jquery/jquery_auto_complete.rb', line 8 def auto_complete_for(object, method, = {}) define_method("auto_complete_for_#{object}_#{method}") do object_constant = object.to_s.camelize.constantize = { :conditions => ["LOWER(#{method}) LIKE ?", '%' + params[:term].downcase + '%'], :order => "#{method} ASC", :limit => 10}.merge!() render :json => object_constant.to_auto_complete(:json, ) end end |