1

I have a Payroll model using which I have to create two different pages in active admin, each with slight change in columns and logic.

ActiveAdmin.register Payroll do
end

ActiveAdmin.register Payroll, as: "Customised Payroll" do
end

In Cancan or Pundit, Giving access to Payroll(as policy name is bound to model name) causes both Payroll and Customised Payroll to be visible together. I want Payroll to be accessible to a set of roles and Customised Payroll to be accessible by a different set of roles.

I cant use the same page with conditional logic/scope for display. It has to be two pages. How do I give role based access differently for the two pages?

Harini
  • 25
  • 1
  • 7

1 Answers1

0

You can create duplicate model for that:

class CustomisedPayroll < Payroll
end

and activeadmin's resource customised_payroll.rb After that you will be able to create ability for two resources

n3mfis
  • 1
  • 1