draper
draper copied to clipboard
Decorators/View-Models for Rails Applications
We're using [datagrid gem](https://github.com/bogdan/datagrid) together with draper decorators. They works very well so far, until recently [datagrid introduces preload feature](https://github.com/bogdan/datagrid/commit/3c756c383ed8ad8ddfd4e74cd502df3242f4bf57), where it actively preloads associations when rendering a ActiveRecord resource....
Hello, I use drapper to decorates models in the context of my app and its admin interface. Say for a model class Document i have 2 different decorators `DocumentDecorator` and...
Today I noticed a weird behaviour during my request spec: The controller defines a helper method which is called from the decorator. But during the test this helper is not...
I have a multi-app application, so declaring `.decorate` results in the common `Could not infer a decorator for ActiveRecord::Base. (Draper::UninferrableDecoratorError)`. So I need to explicitly declare the decoration, which is...
Is there a way to decorate only a collection without decorating the instances? It appems that even if I create a class like "MessagesDecorator" and inherit from "Draper::CollectionDecorator", it would...
Right now there are many issues due to `Draper::ViewContext` inflexibility I would like to suggest to explicitly set Draper::ViewContext, rather than rely on `RequestStore` For example ``` ruby # helper...
Fixes #640 I haven't figured out how to fix this deterministically in the Draper code, yet, but here's a breakdown of the issue and the fix, so hopefully someone can...
Sorry folks, I've pressed enter accidentally without finish it. 😅 _Environment:_ - Rails 5.0.0 - draper 2.1.0 - activemodel-serializers-xml: rails/activemodel-serializers-xml First of all, thank you so much for this great...
More details in #538. This is just extracted from a monkey patch I've used briefly in an application as discussed there. This obviously needs testing but I'm unsure best /...
Imagine a stock portfolio app where a user has_many companies. Say I want to list the value of a user's portfolio broken down by company. I could add a method...