From df7e4870412f0e5cba114cbf663f8c4f5b98a45e Mon Sep 17 00:00:00 2001 From: Andrew Coleman Date: Sat, 21 Mar 2009 21:00:59 -0500 Subject: [PATCH] only logged in users can make pages --- app/controllers/pages.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/pages.rb b/app/controllers/pages.rb index 0437aa7..6a1b8e8 100644 --- a/app/controllers/pages.rb +++ b/app/controllers/pages.rb @@ -1,4 +1,6 @@ class Pages < Application + before :logged_in?, :only => [ :new, :edit, :create, :update, :delete ] + def index @pages = Page.find :all, :order => 'name ASC', :conditions => [ 'published = ?', false ] @secondary_title = 'Wiki Pages. En Masse.' @@ -8,8 +10,10 @@ class Pages < Application def show @page = Page.find_by_name(params[:id].gsub(/_/, ' ')) - if @page.nil? + if @page.nil? and logged_in? redirect url(:new_page, :new_name => params[:id]) + elsif @page.nil? + raise NotFound else @comments = @page.comments @secondary_title = @page.name