Problem
I have a User model, and the Volunteer model that inherits from the User model:
class User < ActiveRecord::Base
end
class Volunteer < User
end
They are both saved on the same table in the database, but have different controllers / routes.
The routes are:
devise_for :users ....
devise_for :volunteers ....
And this works fine and dandy, but the authorization system that I use depends on a current_user helper. And this fails for volunteers because devise creates current_volunteer for the Volunteer model.
What i have tried is to set devise_for :volunteers, :singular => "user", and this creates a current_user that refers to users and volunteers, but the problem now is that the routes for volunteers are messed up.
Question
So my question is, is there any way to have the current_user helper, refer to another model other than user?
I think this way you allow a user to be signed in as a User and a Voluteer in the same session.
Once you have a way to deal with that could you not just have
in your application_controller.rb