jcasimir/draper — pull request #271 by cmer (2012-09-07 20:08:47+00:00)
Title: Added `decorator_class` class and instance methods

This is useful when you want to be able to conditionally specify which decorator class to use for a model by overriding `decorator_class`. For example:

class User < ActiveRecord::Base
def decorator_class
if self.gender == 'male'
MaleUserDecorator
else
FemaleUserDecorator
end
end
end

User.create gender: 'male'
User.first.decorate -> MaleUserDecorator