require 'acts_as_votable/helpers/words'

module ActsAsVotable  #:nodoc:
  # Module Votable
  module Votable
    extend ActiveSupport::Concern

    include Helpers::Words

    # Module ClassMethods
    module ClassMethods

      # Add the votable? response to the models
      def votable?
        false
      end
      # Adds the ability to accept votes
      def acts_as_votable
        has_many :votes, :as => :votable, :class_name => "ActsAsVotable::Vote"

        class_eval do
          include ActsAsVotable::Extenders::Votable
          # Updates the votable? response to the instance objects
          def self.votable?
            true
          end
        end
      end
    end
  end
end

ActiveRecord::Base.send :include, ActsAsVotable::Votable