Prefface
I’m new to rails & programming. Working on my first rails app–I have authentication with omniauth and devise and a simple article submission working for users.
I want to do two things:
-
If a user isn’t a specific role,
reroute them to another page. -
If a preference is ‘offline’ only
allow admins to view the site.
I have yet to create a prefferences table–looking for suggestions. 🙂
What’s the best way to set up simple roles?
What’s the easiest way to redirect users if they’re not admin and if the site is ‘offline’?
I’m currently using CanCan for role-based authorization on my current project. I’ve found it works great including the ability to do both of what you’re looking for. And the documentation! Oh, the documentation. If all gem authors wrote documentation like CanCan’s, I do believe it would bring about world peace.
And as an added bonus, because it was written by Ryan Bates, it has a RailsCast already recorded for it.