Permalink
Browse files

topics model and posts model was logging duplicate ip addresses which…

… creates way to many entries to make heads or tails of. Thats fixed now.
  • Loading branch information...
1 parent da7c9a6 commit b3810ce0b133d352e23d6d44d6ab813999e3887a Paul committed Mar 14, 2010
Showing with 6 additions and 2 deletions.
  1. +3 −1 app/models/post.rb
  2. +3 −1 app/models/topic.rb
View
@@ -54,7 +54,9 @@ def stop_spam
end
def log_ip
- IpUser.create(:user => user, :ip => ip)
+ unless IpUser.find(:first, :conditions => ["user_id = ? AND ip_id = ?", user.id, ip.id])
+ IpUser.create(:user => user, :ip => ip)
+ end
end
def update_forum
View
@@ -42,7 +42,9 @@ class Topic < ActiveRecord::Base
end
def log_ip
- IpUser.create(:user => user, :ip => ip)
+ unless IpUser.find(:first, :conditions => ["user_id = ? AND ip_id = ?", user.id, ip.id])
+ IpUser.create(:user => user, :ip => ip)
+ end
end

0 comments on commit b3810ce

Please sign in to comment.