I’ve become a big fan of decorators, especially Draper.
Decorators allow you to move view related functionality for your models in to separate decorator classes. This keeps both your models and views clean and readable.
Anyway, if you use Devise you’re provided with a
current_user helper. However, this helper returns an instance of
User - without your decorators. To enable decorators for your
current_user by default, simple add this to
def current_user UserDecorator.decorate(super) unless super.nil? end
Now, anywhere in your views where you call
current_user you’ll get a decorated version instead.
If you're seeing this message you've probably enabled some form of adblocker. I respect that.
I use this space to show recommended books on Amazon.com in relation to the post you just read. This generates a small income that allows me to buy a book every now and then.