Sha256: 958b5fb4343698c1b001124527a8cfb4d7b4678ea63d92582361c793da6bddd8

Contents?: true

Size: 532 Bytes

Versions: 2

Compression:

Stored size: 532 Bytes

Contents

module ActsAsVotable::Init
  
  module Votable

    def votable?
      false
    end

    def acts_as_votable(*args)

      class_eval do
        belongs_to :votable, :polymorphic => true

        def self.votable?
          true
        end

        include ActsAsVotable::Votable

      end

      # aliasing
      ActsAsVotable::Alias::words_to_alias self, ActsAsVotable::Vote.true_votes, :count_votes_true
      ActsAsVotable::Alias::words_to_alias self, ActsAsVotable::Vote.false_votes, :count_votes_false

    end


  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_votable-0.0.5 lib/acts_as_votable/init/votable.rb
acts_as_votable-0.0.4 lib/acts_as_votable/init/votable.rb