Skip to content

Instantly share code, notes, and snippets.

@etozzato
Created March 17, 2011 23:41
Show Gist options
  • Select an option

  • Save etozzato/875376 to your computer and use it in GitHub Desktop.

Select an option

Save etozzato/875376 to your computer and use it in GitHub Desktop.
def load_user
if params[:id] =~ /\D+/
@user = User.find_by_username(params[:id])
else
@user = User.find_by_id(params[:id])
end
raise ActiveRecord::RecordNotFound if @user.nil?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment