Sha256: f868f3aabbb16c0a18d14f52dc8be6cc8be9c55deace4ef661ea2ce2d5099def

Contents?: true

Size: 774 Bytes

Versions: 5

Compression:

Stored size: 774 Bytes

Contents

module Ratable
  module Models
    module Ratable

      module ActiveRecordExtension
        def acts_like_ratable?
          classes = ancestors
          classes.include?(Ratee) || classes.include?(Rater)
        end

        def acts_like_ratee?
          ancestors.include?(Ratee)
        end

        def acts_like_rater?
          ancestors.include?(Rater)
        end
      end

      module ActiveRecordInclusion
        def acts_like_ratable?
          classes = self.class.ancestors
          classes.include?(Ratee) || classes.include?(Rater)
        end

        def acts_like_ratee?
          self.class.ancestors.include?(Ratee)
        end

        def acts_like_rater?
          self.class.ancestors.include?(Rater)
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ratable-0.0.5 lib/ratable/models/ratable.rb
ratable-0.0.4 lib/ratable/models/ratable.rb
ratable-0.0.3 lib/ratable/models/ratable.rb
ratable-0.0.2 lib/ratable/models/ratable.rb
ratable-0.0.1 lib/ratable/models/ratable.rb