This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
def current_ability | |
@current_ability ||= Ability.new(current_member) | |
end | |
rescue_from CanCan::AccessDenied do |exception| | |
flash[:alert] = "Access Denied." | |
redirect_to root_url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionsController < ApplicationController | |
def new | |
if member = Member.find_by_password_digest(cookies[:digest]) | |
session[:member_id] = member.id | |
redirect_to (session[:ref] || root_path), :notice => "Welcome back #{member.first_name}" | |
end | |
end | |
def create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Log In</h2> | |
<%= form_tag sessions_path do %> | |
<div class="field"> | |
<%= label_tag :user_name %><br> | |
<%= text_field_tag :user_name, params['user_name'] %> | |
</div> | |
<p></p> | |
<div class="field"> | |
<%= label_tag :password %><br/> |