Comments (8)
The docs suggest moving the coupons to a partial, passing order.coupons as local. Looks reasonable, as it also avoids a Law Of Demeter issue.
from active_decorator.
I have the same problem.
from active_decorator.
Same problem here...
from active_decorator.
Same problem...
from active_decorator.
Another quick workaround. Just make a helper method:
def decorate(var)
ActiveDecorator::Decorator.instance.decorate var
end
And then call it in your view when needed
- for coupon in @order.coupons
- decorate coupon
= coupon.type_description
from active_decorator.
Same problem
from active_decorator.
The docs suggest moving the coupons to a partial, passing order.coupons as local. Looks reasonable, as it also avoids a Law Of Demeter issue.
https://github.com/amatsuda/active_decorator#decorating-associated-objects
from active_decorator.
This feature has been implemented in #8 and already available in recent releases.
from active_decorator.
Related Issues (20)
- Bug when using ActionController::API HOT 2
- Write active decorator DRY HOT 5
- Cannot use decorator methods in decorator HOT 2
- Decoration fails using ApplicationController.renderer.render with Rails 6.1
- method_missing for helpers is slow HOT 2
- SystemStackError(stack level too deep) caused by recursive method_missing
- How Decorate Namespaced Models? HOT 1
- Cannot use decorator methods in layout HOT 4
- STI support on released version HOT 3
- Single Table Inheritance HOT 2
- NameError in decorator is not handled properly
- Update repo description HOT 1
- Support for ActionController::API HOT 2
- Decorating other Ruby objects HOT 1
- ActiveDecorator vs Draper HOT 1
- Url helpers in test HOT 2
- Raise 「NameError: undefined local variable or method `view_context'」 when ActionController::API is inherited HOT 2
- Failed to invoke helpers with activejob HOT 2
- How to decorate Devise's current_user ? HOT 2
- association decoration conflagration HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from active_decorator.