Я использую https://github.com/crowdint/rails3-jquery-autocomplete и, похоже, работает. Единственная проблема - скажем, у меня есть поле, выполняющее автозаполнение всех заголовков сообщений, но я хочу, чтобы оно отображало только заголовки сообщений, созданных пользователем.
Есть ли способ сделать что-то подобное? То есть find_by или что-то?
Спасибо!
-Elliot
EDIT
в документации сказано:
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
Я чувствую, что это можно использовать, чтобы добиться того, чего я пытаюсь достичь, но я понятия не имею, с чего начать?