Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/glacials/splits-io. a speedrunning data store and analysis engine splits.io
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142class Users::PbsController < ApplicationController before_action :set_user, only: [:show] before_action :set_game, only: [:show] before_action :set_category, only: [:show]
def show if @user.gold_patron? if params[:trailing_path].nil? redirect_to run_path(@user.pb_for(@category)) else redirect_to "#{run_path(@user.pb_for(@category))}/#{params[:trailing_path]}" end else redirect_to user_path(@user), alert: 'Redirectors are not enabled for this account.' end end
private
def set_user @user = User.find_by(name: params[:user]) || not_found end
def set_game @game = Game.where(shortname: params[:game]).or(Game.where(id: params[:game])).first
if @game.nil? not_found end end
def set_category @category = @game.categories.where(shortname: params[:category]).or( @game.categories.where(id: params[:category]) ).first
if @category.nil? not_found end endend