Created
October 3, 2011 01:52
-
-
Save bbonamin/1258276 to your computer and use it in GitHub Desktop.
rails3-jquery-autocomplete in ActiveAdmin?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ActiveAdmin.setup do |config| | |
| #... | |
| config.register_javascript 'autocomplete-rails.js' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'http://rubygems.org' | |
| gem 'rails3-jquery-autocomplete' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Cpr::Application.routes.draw do | |
| #... | |
| resources :flights do | |
| get :autocomplete_pilot_name, :on => :collection | |
| end | |
| end |
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
I think the css was messed up for autocomplete