]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/diary_entry_controller.rb
Use params[] instead of @params[] to avoid deprecation warnings.
[rails.git] / app / controllers / diary_entry_controller.rb
index 7c77fc177394280ba823c56a8be2aee9b47b2eb8..f8e2a5761d58575189b74c36b72af987ea44ef9c 100644 (file)
@@ -1,2 +1,20 @@
 class DiaryEntryController < ApplicationController
+  layout 'site'
+  
+  before_filter :authorize_web
+  before_filter :require_user, :only => [:new]
+
+  def new
+    if params[:diary_entry]     
+      @entry = DiaryEntry.new(params[:diary_entry])
+      @entry.user = @user
+      if @entry.save 
+        redirect_to :controller => 'user', :action => 'diary', :display_name => @user.display_name 
+      end
+    end
+  end
+  
+  def list
+    @entries=DiaryEntry.find(:all, :order => 'created_at DESC', :limit=>20)
+  end
 end