Я ' m, используя https://github.com/crowdint/rails3-jquery-autocomplete , и, похоже, он работает. Единственная проблема - допустим, у меня есть поле, выполняющее автозаполнение для всех заголовков сообщений, но я хочу, чтобы оно отображало только заголовки сообщений, созданных пользователем.
Есть ли способ сделать что-то подобное? То есть find_by или что-то в этом роде?
Спасибо!
-Эллиот
РЕДАКТИРОВАТЬ
в документации говорится:
If you want to display a different version of what you're looking for, you can use the :display_value option.
This options receives a method name as the parameter, and that method will be called on the instance when displaying the results.
class Brand < ActiveRecord::Base
def funky_method
"#{self.name}.camelize"
end
end
class ProductsController < Admin::BaseController
autocomplete :brand, :name, :display_value => :funky_method
end
In the example above, you will search by name, but the autocomplete list will display the result of funky_method
Я чувствую, что это можно использовать, чтобы сделать то, что я пытаюсь выполнить, но я понятия не имею, с чего начать?