1

I am very new to Rails and Ruby but I am involved on a project as a trainee, which uses Pundit for authorization of users.

Our project uses delayed_job_active_record gem and I wanted to add delayed_job_web for a quick and easy view of jobs.

I can see that documentation for the latter gem uses basic rack authorisation or devise gem when matching or mounting the route to DelayedJobWeb.

I looked and googled but I couldn't find any suggestions on how to use Pundit instead (so that when you type the link yourself it doesn't allow you to see it unless you are an admin).

Any ideas of how this can be done please?

Employee
  • 3,109
  • 5
  • 31
  • 50

1 Answers1

1

in your routes you could do something like this:

authenticate :user, lambda { |u| u.admin? } do          
  mount DelayedJobWeb => '/delayedjobweb'
end
johan
  • 721
  • 5
  • 21
  • Hi NEL, thank you for your answer. Unfortunately this does not work for me as I am working with Pundit not Devise or Warden. – patrick_a06 Jan 22 '19 at 11:58