Created
August 4, 2009 22:28
-
-
Save thoughtbot/162335 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 UsersController < Clearance::UsersController | |
def create | |
... | |
sign_in(@user) | |
end | |
end | |
class ParticipationsController < ApplicationController | |
protected | |
def ensure_signed_in | |
unless signed_in? | |
store_location | |
flash[:failure] = "Please sign in to participate in this deal." | |
redirect_to sign_in_path | |
end | |
end | |
end | |
module NavigationHelper | |
def authentication_links | |
if signed_in? | |
signed_in_links | |
else | |
signed_out_links | |
end | |
end | |
def signed_out_links | |
[link_to("Sign up", sign_up_path), | |
link_to("Sign in", sign_in_path)] | |
end | |
def signed_in_links | |
[link_to("My Account", edit_user_path(current_user)), | |
link_to("Sign out", sign_out_path)] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment