Last active
May 13, 2019 21:36
-
-
Save jattoabdul/040a576e8d467fb6c27076a0f71e3540 to your computer and use it in GitHub Desktop.
Using Active Support Concerns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'activesupport/concern' | |
module Noteable | |
extend ActiveSupport::Concern | |
included do | |
has_many :notes, as: :noteable | |
end | |
def note_taking_action | |
# do stuff here | |
end | |
... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product < ActiveRecord::Base | |
include Noteable | |
... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment