]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Have a nice translated alt and title for the sotm and donation.
[rails.git] / app / models / user.rb
index ce244fe02448bce114dbb79d25b6a009a4848f28..85d9713169cdb5d148a07114d1947cd6f2c033c9 100644 (file)
@@ -1,6 +1,8 @@
 class User < ActiveRecord::Base
   require 'xml/libxml'
 
+  belongs_to :language, :foreign_key => 'locale'
+  
   has_many :traces
   has_many :diary_entries, :order => 'created_at DESC'
   has_many :messages, :foreign_key => :to_user_id, :order => 'sent_on DESC'
@@ -30,7 +32,7 @@ class User < ActiveRecord::Base
   file_column :image, :magick => { :geometry => "100x100>" }
 
   def after_initialize
-    self.creation_time = Time.now if self.creation_time.nil?
+    self.creation_time = Time.now.getutc if self.creation_time.nil?
   end
 
   def encrypt_password
@@ -113,7 +115,7 @@ class User < ActiveRecord::Base
   def delete
     self.active = false
     self.display_name = "user_#{self.id}"
-    self.description = nil
+    self.description = ""
     self.home_lat = nil
     self.home_lon = nil
     self.image = nil