Instead of defining an included
method to handle extending a class, we can
extend ActiveSupport::Concern
.
It is actually a pretty simple but powerful concept. It has to do with code reuse as in the example below. Basically, the idea is to extract common and/or context specific chunks of code in order to clean up the models and avoid them getting too fat and messy.
- Put chubby models on a diet with concerns
- ActiveSupport::Concern - Warning: Foo/Bar examples (ugh).