Created
November 29, 2011 20:06
-
-
Save davidcelis/1406231 to your computer and use it in GitHub Desktop.
Example permalink matching
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
# Permalink matching | |
match "/users/:username" => "users#show", as: "user" |
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 show | |
@user = User.find_by_username(params[:username]) | |
if @user.nil? | |
redirect_to '/404.html' and return | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment