]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Serve up paperclip attachments in a cache friendly way
[rails.git] / app / models / user.rb
index cf506e7c9e7192860d0c75ccea5e746ce7894b2f..9a230898a87779160d1038cac73b1e0ef498b2a3 100644 (file)
@@ -44,7 +44,9 @@ class User < ActiveRecord::Base
   after_initialize :set_creation_time
   before_save :encrypt_password
 
-  file_column :image, :magick => { :geometry => "100x100>" }
+  has_attached_file :image, 
+    :default_url => "/assets/:class/:attachment/:style.png",
+    :styles => { :large => "100x100>", :small => "50x50>" }
 
   def self.authenticate(options)
     if options[:username] and options[:password]
@@ -198,7 +200,7 @@ class User < ActiveRecord::Base
     diary_entry_score = self.diary_entries.inject(0) { |s,e| s += OSM.spam_score(e.body) }
     diary_comment_score = self.diary_comments.inject(0) { |s,e| s += OSM.spam_score(e.body) }
 
-    score = OSM.spam_score(self.description) * 2
+    score = OSM.spam_score(self.description)
     score += diary_entry_score / self.diary_entries.length if self.diary_entries.length > 0
     score += diary_comment_score / self.diary_comments.length if self.diary_comments.length > 0
     score -= changeset_score