lib/voteable_mongo/voter.rb in voteable_mongo-0.8.1 vs lib/voteable_mongo/voter.rb in voteable_mongo-0.9.0

- old
+ new

@@ -1,12 +1,10 @@ module Mongo module Voter extend ActiveSupport::Concern included do - include ::Mongoid::Document - scope :up_voted_for, lambda { |votee| where(:_id => { '$in' => votee.up_voter_ids }) } scope :down_voted_for, lambda { |votee| where(:_id => { '$in' => votee.down_voter_ids }) } scope :voted_for, lambda { |votee| where(:_id => { '$in' => votee.voter_ids }) } end @@ -39,10 +37,10 @@ # @return [Symbol, nil] :up or :down or nil if not voted def vote_value(options) votee = unless options.is_a?(Hash) options else - options[:votee] || options[:votee_type].classify.constantize.only(:votes).where( + options[:votee] || options[:votee_type].classify.constantize.where( :_id => options[:votee_id] ).first end votee.vote_value(_id) end