diff --git a/lib/the_moderator/model.rb b/lib/the_moderator/model.rb index a310574..951bbe8 100644 --- a/lib/the_moderator/model.rb +++ b/lib/the_moderator/model.rb @@ -1,7 +1,14 @@ +require 'active_support/concern' + module TheModerator module Model - def self.included(base) - base.has_many :moderations, as: :moderatable, dependent: :destroy + extend ActiveSupport::Concern + + included do + has_many :moderations, as: :moderatable, dependent: :destroy + end + + module ClassMethods end def moderate(*moderated_attributes) diff --git a/lib/the_moderator/moderation_model.rb b/lib/the_moderator/moderation_model.rb index 3288869..0c28275 100644 --- a/lib/the_moderator/moderation_model.rb +++ b/lib/the_moderator/moderation_model.rb @@ -1,12 +1,12 @@ +require 'active_support/concern' + module TheModerator module ModerationModel - def self.included(base) - base.send :extend, ClassMethods + extend ActiveSupport::Concern - base.class_eval do - belongs_to :moderatable, polymorphic: true - serialize :data - end + included do + belongs_to :moderatable, polymorphic: true + serialize :data end module ClassMethods diff --git a/the_moderator.gemspec b/the_moderator.gemspec index 1c87675..a38f3d5 100644 --- a/the_moderator.gemspec +++ b/the_moderator.gemspec @@ -20,6 +20,7 @@ Gem::Specification.new do |spec| spec.add_dependency "activemodel", "~> 3.2.0" spec.add_dependency "activerecord", "~> 3.2.0" + spec.add_dependency "activesupport", "~> 3.2.0" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake"