Created
February 18, 2012 00:18
-
-
Save juanm55/1856452 to your computer and use it in GitHub Desktop.
something I did to avoid using 2 root_paths in my routes
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
def home | |
# get 'login', :to => 'devise/sessions#new' in my routes.rb | |
redirect_to 'login' unless current_user #if not logged in, kick him out of here! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
which would enforce authentication for all of the actions in the controller and redirect to the action I tell it to,,, and it can be passed regular, :only and :except
I'll consider it for a next project! thanks,,, plus it has a "Very active" (at ruby toolbox) development activity too, so I definitely have to check it out
I really like that if I write the controllers and the logic, I know it, and I know what is being done,,,, with Devise all that logic (the code itself) is hidden (guess for security reasons...)
not
, it is more readablethe single line
if
I have used it,,, simply didn't remember it on place,,,, and I also like the ternary operator (i saw it on js) and I know there is something similar in ruby but haven't looked up the syntax yetabout this same topic, I have been reading the ruby documentation lately and the rails best practices web, but maybe those aren't the places to find this kind of advices/tricks, if you got any resource that can lead me "out of the dark side" I would greatly appreciate those