work on post views

This commit is contained in:
albert
2010-03-12 12:32:31 -05:00
parent 15c134b270
commit 9f29ffc8c3
18 changed files with 486 additions and 317 deletions

View File

@@ -1,6 +1,4 @@
class SessionsController < ApplicationController
before_filter :member_only, :only => [:destroy]
def new
@user = User.new
end
@@ -9,14 +7,14 @@ class SessionsController < ApplicationController
if User.authenticate(params[:name], params[:password])
@user = User.find_by_name(params[:name])
session[:user_id] = @user.id
redirect_to(params[:url] || posts_path, :notice => "You have logged in")
redirect_to(params[:url] || posts_path, :notice => "You are now logged in.")
else
render :action => "edit", :flash => "Password was incorrect"
redirect_to(new_session_path, :notice => "Password was incorrect.")
end
end
def destroy
session[:user_id] = nil
redirect_to(posts_path, :notice => "You have logged out")
session.delete(:user_id)
redirect_to(posts_path, :notice => "You are now logged out.")
end
end