Decorating Devise’s current_user with Draper – Ariejan.net
A great trick to decorate the current_user method from devise using Draper.
IMHO it’s actually applicable to any authentication system out there that is using current_user but that requires some testing.
Decorators are an awesome way to remove logic from the view or the models, so the models have real business logic and the rest can be “decorated” with another class.
If you are looking for more information about decorators, Ryan Bates has a great screencast about it here: http://railscasts.com/episodes/286-draper
EnjoySubmit to Hacker News
[NOTE] This post has been imported to Hugo from a Wordpress blog. It may be broken, missing images, code snippets or other information.
[NOTE] updated April 15, 2012. It's 2403 days old . This article may have outdated content.