Reputation: 1
I want to make an app which allows people to register for certain type of event. It wouldn't require signing up - you just choose a city, hour, and fill in the form with your data, click on "Register" or "Book" and that's all. List of cities will change from time to time, and I obviously need to create new events - in different cities, with different addresses etc.
So for a regular user,it's just a simple page, but for admin there should be options for creating new events, showing all people registered for an event etc. I'm aware of Devise, AdminRails, CanCanCan, but ad a beginner I'm not sure how to hide signing up/logging possibility from a regular user.
Devise will make my app accessible after signing in and it's not my intention. I want regular app with a few views and form, and in some sense seperate admin panel with regular CRUD - create an event, list events, list users, delete events, delete users.
I'll be greateful for any hints.
Upvotes: 0
Views: 458
Reputation: 2030
When adding authentication you classically add before_action :authenticate_user!
on the ApplicationController in order to force users to be authenticated.
So either you do not call it here, and call it only on your admin controllers or
you skip_before_action :authenticate_user!
in your regular user controllers.
Add a simple AdminController that you can only access when connected, then when you try yourapp.com/admin you'll be redirected to the login form of devise. (If you need several admin controllers, namespace them inside an 'admin' scope.)
Your users won't notice or care about this specific admin area if you do not advertize it.
Upvotes: 1