# File lib/has_karma.rb, line 45 def karma(options = {}) #FIXME cannot have 2 models imapcting the karma simultaneously # count the total number of votes on all of the voteable objects that are related to this object #2009-01-30 GuillaumeNM The following line is not SQLite3 compatible, because boolean are stored as 'f' or 't', not '1', or '0' #self.karma_voteable.sum(:vote, options_for_karma(options)) #self.karma_voteable.find(:all, options_for_karma(options)).length karma_value = 0 self.class.karmatic_objects.each do |object| karma_value += object.find(:all, options_for_karma(object, options)).length end return karma_value end