Add a list of languages and fix a few issues with the schema. Also get
[rails.git] / app / models / diary_entry.rb
index 33e95d17508057e3a9447a238a4e3faaeed7e296..705438213628fe9fbb001cc608f7500968280ed4 100644 (file)
@@ -1,6 +1,6 @@
 class DiaryEntry < ActiveRecord::Base
   belongs_to :user
-  belongs_to :language, :foreign_key => 'language'
+  belongs_to :language, :foreign_key => 'language_code'
   
   has_many :diary_comments, :include => :user,
                             :conditions => ["users.visible = ?", true],
@@ -14,4 +14,5 @@ class DiaryEntry < ActiveRecord::Base
   validates_numericality_of :longitude, :allow_nil => true,
                             :greater_than_or_equal_to => -180, :less_than_or_equal_to => 180
   validates_associated :user
+  validates_associated :language
 end