Sha256: 4ea4344e3ef89328bad55e05fce10d9a0ce0ec13cec56682bbc723f04efb63ab

Contents?: true

Size: 590 Bytes

Versions: 4

Compression:

Stored size: 590 Bytes

Contents

module ReadActivity
  def self.included(base)
    base.extend Module
  end

  module Module
    def acts_as_reader
      extend Reader::ClassMethods
      include Reader::InstanceMethods

      Reader.register_klass(self)

      ReadActivityMark.belongs_to :reader, class_name: self.to_s
      has_many :read_activity_marks, foreign_key: "reader_id", dependent: :delete_all
    end

    def acts_as_readable
      extend Readable::ClassMethods
      include Readable::InstanceMethods

      Readable.register_klass(self)

      has_many :read_activity_marks, as: :readable
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
read_activity-0.1.0 lib/read_activity/module.rb
read_activity-0.0.4 lib/read_activity/module.rb
read_activity-0.0.3.1 lib/read_activity/module.rb
read_activity-0.0.3 lib/read_activity/module.rb