In Active Admin (RoR), I’m getting data from a table, no problem with that.
But I want to add a sidebar with information thats related with an inner join.
But I don’t know how to do this.
This my code:
ActiveAdmin.register Project do
show do |project|
... works ...
end
end
sidebar "Resources for this project", :only => :show do
table_for project.project_resources.where('project_id = ?', project.id) do |row|
column "Resource", Resource.where('id = ?', :resource_id) do |resource|
:resource_name
end
end
end
As you can see, I’m trying to get the resource_name from resources-table. There is a 3th table, project_resource and this contains all the resource_ids for a project_id.
Thanks
Ok, this is the answer I was looking for: