How to make Devise return a subclass of user
05:16 13 Oct 2015

I have devise which authenticates a user. User is split up into subclasses such as User::AsProfile < User or User::AsRegistrant< User. These are not Single Table Inheritance classes, just plain old ruby-objects that inherit from User.

I'd like devises' current_user helper to return an instance of User::AsProfile.

Unfortunately, Device has a lot of metaprogamming hidden away in class_eval so it is hard to understand what is going on.

Can I configure Devise to return another class (User::AsProfile) when running current_user in a controller?

Or must I override current_user in my controller to do so, and if so, how should I call warden to authenticate properly?

ruby-on-rails devise warden