Skip to content

Instantly share code, notes, and snippets.

@kirs
Created July 17, 2017 16:43
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 kirs/7a7ae0339a4fd78d27f7b4f429587c87 to your computer and use it in GitHub Desktop.
Save kirs/7a7ae0339a4fd78d27f7b4f429587c87 to your computer and use it in GitHub Desktop.
require 'bundler/setup'
require 'active_support/all'
module Feature
extend ActiveSupport::Concern
included do |base|
puts "#{base} included Feature"
end
end
class AbstractRecord
include Feature
end
class MyRecord < AbstractRecord
include Feature
end
# output:
# AbstractRecord included Feature
module Feature
def self.included(base)
puts "#{base} included Feature"
end
end
class AbstractRecord
include Feature
end
class MyRecord < AbstractRecord
include Feature
end
# output:
# AbstractRecord included Feature
# MyRecord included Feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment