RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

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

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in