A Decorator vs. a Subclass
Rails 5.1 added a great new feature, delegate_missing_to. With delegate_missing_to, any method that you can’t find on one object is called on another object, instead. In the pull request, DHH said it makes it easier to build decorators. But what is a decorator? And why would you use one instead of a subclass?
Post a comment