Activeadmin: How to display nested attributes in show?

Created on 11 Jun 2012  路  2Comments  路  Source: activeadmin/activeadmin

Is it possible to display nested resource in the show page? I am looking for examples nut there is nothing, how can it be done?

Most helpful comment

@sylario, here's an example. I prefer to use a sidebar to hold the main record's details, while using the main part of the page for associated records.

ActiveAdmin.register User do
  show do
    panel "Owned Books" do
      table_for user.books do
        column :title
        # ...
      end
    end
  end
  sidebar "User Information", only: [:show, :edit] do
    attributes_table_for user do
      row :full_name
      row :role
    end
  end
end

@jasperkennis, your link was for forms, but OP is talking about the show page

All 2 comments

My previous comment made no sense at all, sorry for that. Does this answer your question:

https://github.com/gregbell/active_admin/issues/59

@sylario, here's an example. I prefer to use a sidebar to hold the main record's details, while using the main part of the page for associated records.

ActiveAdmin.register User do
  show do
    panel "Owned Books" do
      table_for user.books do
        column :title
        # ...
      end
    end
  end
  sidebar "User Information", only: [:show, :edit] do
    attributes_table_for user do
      row :full_name
      row :role
    end
  end
end

@jasperkennis, your link was for forms, but OP is talking about the show page

Was this page helpful?
0 / 5 - 0 ratings