Add a list of languages and fix a few issues with the schema. Also get
[rails.git] / app / controllers / diary_entry_controller.rb
index 9ce5409d6a6da5818d11d5a085fb08ae87bc5aa9..96bf154a6121b211a2b6159ada68107c4606c1e3 100644 (file)
@@ -13,8 +13,6 @@ class DiaryEntryController < ApplicationController
     if params[:diary_entry]     
       @diary_entry = DiaryEntry.new(params[:diary_entry])
       @diary_entry.user = @user
-      @diary_entry.language = Language.find_by_code(params[:language])
-      @diary_entry.language = Language.find_by_code("en") if @diary_entry.language.nil?
 
       if @diary_entry.save 
         redirect_to :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name 
@@ -22,6 +20,7 @@ class DiaryEntryController < ApplicationController
         render :action => 'edit'
       end
     else
+      @diary_entry = DiaryEntry.new(:language => @user.language)
       render :action => 'edit'
     end
   end