Respecting associations with rails

We are using rails_admin plug in to manage back end for a classroom. There is an admin(Coordinator) and several moderators(Teaching assistants). The admin and moderators should be able to add students to the database. Each student is associated with a moderator(TA). When a moderator clicks to view the students the rails_admin renders all the students in the database. How can we restrict rails_admin to show only those students whose TA is the moderator who is logged in? Admin should be able to see all the students in the database.


Rails_admin has this capability built in. You've got a couple of options as per their wiki page:

  • Editing the config/initializers/rails_admin.rb configuration file as per this section
  • Or my personal preference, using CanCan or CanCanCan as per this section
  • Happy to help if you run in to more specific issues.

    Good luck!

    Edit: Bonus link for CanCan & rails_admin, again on their wiki

    链接地址: http://www.djcxy.com/p/67060.html

    上一篇: 如何更改轨道中的工具提示has

    下一篇: 尊重与铁路的关联