When I edit a record that has a belongs_to association in ActiveAdmin, I'd like to search for potential records instead of choosing from a select list (the default option).
For example, I have a Post object that belongs to User. When I edit a post, I'd like to be able to search for a user to change the who owns the Post, but currently I have to choose from a select list of existing users. The list is so large that some users are not included on the list.
# app/models/user.rb
class User < ActiveRecord::Base
attr_accessible :name
has_many :posts
end
# app/models/post.rb
class Post < ActiveRecord::Base
belongs_to :post
end
# app/admin/posts.rb
ActiveAdmin.register Post do
index do
column :user do |post|
link_to post.user.name, admin_user_path(post.user)
end
column :content
end
form do |f|
# What goes here to search for a user instead of choosing one from the dropdown?
end
end