has_many :tokens, :class_name => "UserToken"
has_many :preferences, :class_name => "UserPreference"
has_many :changesets, :order => 'created_at DESC'
+ has_many :note_comments, :foreign_key => :author_id
+ has_many :notes, :through => :note_comments
has_many :client_applications
has_many :oauth_tokens, :class_name => "OauthToken", :order => "authorized_at desc", :include => [:client_application]
##
# return a spam score for a user
def spam_score
- changeset_score = self.changesets.limit(10).length * 50
- trace_score = self.traces.limit(10).length * 50
+ changeset_score = self.changesets.size * 50
+ trace_score = self.traces.size * 50
diary_entry_score = self.diary_entries.inject(0) { |s,e| s += e.body.spam_score }
diary_comment_score = self.diary_comments.inject(0) { |s,c| s += c.body.spam_score }