我正在为管理面板使用活动管理员。在用户展示页面上,我需要展示他的朋友。我有两个模型用户和朋友。
我想在“与面板的友谊”即user.friends
块中添加分页。
如何在一个面板上添加分页?这是我正在使用的代码。
show do
attributes_table do
row("Photo") { |user| image_tag(user.facebook_photo_url) }
rows :name, :sex,:city
end
panel 'Friendship with' do
table_for user.friends do
column "" do |friend|
(link_to image_tag(friend.facebook_photo_url('small')), admin_friend_path(friend)) + " ".html_safe + (link_to friend.name, admin_user_path(friend))
end
end
end
active_admin_comments
end
Friend 模型实际上是 Facebook 朋友,所以我不能在 User 模型上使用自引用连接(所以不要说使用一个模型而不是两个模型),并且我在同一页面上有一些其他面板。我需要确保每个面板都有自己的分页参数名称,这样它们就不会相互冲突。