Convention-based decorator autoloading for Rails models.
Decorators are plain Ruby modules that get automatically included into your model classes based on file naming convention — no configuration required.
Why not Draper? Draper wraps objects in presenter classes.
auto_decoratoradds methods directly to the model. Less indirection, less boilerplate, same result for most use cases.
#Example
# app/decorators/user_decorator.rb
module UserDecorator
def full_name
[first_name, last_name].compact.join(" ")
end
end
user = User.find(1)
user.full_name # => "Alice Smith"