]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Replace deprecated methods with modern equivalents
[rails.git] / app / models / user.rb
index cf506e7c9e7192860d0c75ccea5e746ce7894b2f..1f8d326d5dc1c3bf9f66b5fffe3227f5595b8577 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, :styles => { :thumb => "100x100>" }, 
+    :path => "#{ATTACHMENTS_DIR}/user/image/:id/:filename",
+    :url => "/user/image/:id/:filename"
 
   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