Skip to content

Instantly share code, notes, and snippets.

@radavis
Created October 3, 2017 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radavis/320fcf3f7a22c06eb666f0fbf0d838fa to your computer and use it in GitHub Desktop.
Save radavis/320fcf3f7a22c06eb666f0fbf0d838fa to your computer and use it in GitHub Desktop.

ActiveSupport::Concern

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.

source

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment