// the find
amatsuda/active_decorator
ORM agnostic truly Object-Oriented view helper for Rails 4, 5, 6, 7, and 8
ActiveDecorator extends model instances with per-model decorator modules (`UserDecorator` for `User`) as they pass from controller to view, into partials rendered with `object:`, `collection:`, or `locals:`, and into ActiveRecord association results. Views can call decorator methods like `full_name` directly on the model without wrapper objects. It suits Rails apps that want decorator modules without adding a presenter layer.
- Decoration extends the record rather than wrapping it, so the decorator runs in the model's own context. `self` is the record, attributes are direct calls, and there is no delegation boilerplate.
- Association propagation is the useful part. Once `@author` is decorated, `@author.books` yields `BookDecorator`-enhanced records, so the view never has to remember to decorate children.
- The escape hatches are explicit. `ActiveDecorator::ViewContext.run_with` gives ActionView helpers like `link_to` to background jobs, and `Decorator.instance.decorate` lets specs exercise a decorator without a request cycle.
- The footprint is small. The `lib/` tree is a handful of files plus a config object with one documented setting, `decorator_suffix`, so the whole mechanism is readable in an afternoon.
- The mixing is implicit. A method on `@author` may come from a module the view never names, and grepping the call site finds nothing. The same object also behaves differently in a mailer or job unless that code is wrapped in `run_with`, which is easy to forget.
- Most of the work is monkey patching Rails internals. `lib/active_decorator/monkey/` patches controller rendering, the partial and collection renderers in ActionView, and ActiveRecord associations, across a support range from Rails 4.2 to 8.2 and Ruby 2.1 to trunk. Every Rails release that moves those internals is a breakage risk, and a range that wide makes that surface harder to keep stable.
- The 'ORM agnostic' claim is narrower than the headline. The association hook lives only under `monkey/active_record/`, so auto-decorating children is ActiveRecord-specific. ActiveResource and plain Ruby objects get only the render-time path.