Skip to content

Instantly share code, notes, and snippets.

@matenia
Created March 3, 2012 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matenia/1964911 to your computer and use it in GitHub Desktop.
Save matenia/1964911 to your computer and use it in GitHub Desktop.
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