Created
March 3, 2012 07:41
-
-
Save matenia/1964911 to your computer and use it in GitHub Desktop.
Stack Overflow: http://stackoverflow.com/questions/9496277/newbie-issues-with-updating-redirect-profile-and-friendly-id
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
def edit | |
@profile = Profile.find(params[:username]) | |
what = params[:what] | |
if not what.nil? | |
if ["basics", "location", "details", "photos", "interests"].member?(what) | |
render :action => "edit_#{what}" | |
else | |
render :action => "edit_basics" | |
end | |
end | |
end | |
### CHANGE TO ### | |
def edit | |
@profile = Profile.find(params[:username]) | |
what = params[:what] | |
# OPTIONALLY USE .include? INSTEAD OF .member? | |
if ["basics", "location", "details", "photos", "interests"].member?(what) | |
render :action => "edit_#{what}" | |
else | |
render :action => "edit_basics" | |
end if what.present? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment