Last updated

Decorating Sorcery's current_user with Draper

I already wrote about how to apply your decorator to the current_user when you’re using Devise. However, the trick is a bit different when applied to Sorcery.

Instead of being nil when no user is signed in, Sorcery uses an explicit false value, no nil. In your ApplicationController at app/controllers/application_controller.rb add this:

1def current_user
2  UserDecorator.decorate(super) unless super == false
3end

I’m using the most recent version of Draper by the way.