Skip to content

Instantly share code, notes, and snippets.

@bbonamin
Created October 3, 2011 01:52
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save bbonamin/1258276 to your computer and use it in GitHub Desktop.
Save bbonamin/1258276 to your computer and use it in GitHub Desktop.
rails3-jquery-autocomplete in ActiveAdmin?
ActiveAdmin.setup do |config|
#...
config.register_javascript 'autocomplete-rails.js'
end
ActiveAdmin.register Flight do
#...
controller do
autocomplete :pilot, :name, :full => true
end
form do |f|
f.input :pilot_name, :as => :autocomplete, :url => autocomplete_pilot_name_flights_path
end
end
source 'http://rubygems.org'
gem 'rails3-jquery-autocomplete'
Cpr::Application.routes.draw do
#...
resources :flights do
get :autocomplete_pilot_name, :on => :collection
end
end
@jerryshen
Copy link

I think the css was messed up for autocomplete

@erem-ifg
Copy link

If you're using the jquery-ui gem,
don't forget to add the jquery.ui.theme.css file to active_admin stylesheets:

In config/active_admin.rb:
config.register_stylesheet 'jquery.ui.theme.css'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment