Active Admin Hackery
A few tips on customizing ActiveAdmin, the Ruby on Rails Admin Framework.
Customizing the Index Page:
If you have customized the index page, you might want to get back links to the object which was previously linked by the ID field. You can do that like this:
ActiveAdmin.register Post do
index do
selectable_column
column :name do |post|
link_to post.name, admin_post_path(post)
end
column :author
#...
end
end
Customizing the show page:
You can have tables for related models within a show page like this:
show do
attributes_table do
row :title
#...
endpanel :comments do
table_for post.comments do
column :body
#...
end
end
end
Custom Column with links to multiple actions:
In a similar situation, you may want to add custom links to the earlier panel. You can do that in the following way:
column "Actions" do |comment|
text_node link_to "View", admin_comment_path(comment)
text_node " ".html_safe
text_node link_to "Edit", edit_admin_comment_path(comment)
text_node " ".html_safe
text_node link_to "Delete", delete_comment_admin_page_path(page, :comment => content_item.id), :method => 'delete'
end