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.
1234567891011121314151617181920212223242526class Api::V3::Games::RunsController < Api::V3::ApplicationController before_action :set_game, only: [:index] before_action :set_runs, only: [:index]
def index runs = paginate @runs render json: Api::V3::RunBlueprint.render(runs, root: :runs) end
private
def set_game @game = Game.joins(:srdc).find_by(speedrun_dot_com_games: {shortname: params[:game_id]}) @game ||= Game.find(params[:game_id]) rescue ActiveRecord::RecordNotFound render status: :not_found, json: { status: 404, message: "Game with shortname or id '#{params[:game_id]}' not found." } end
def set_runs @runs = @game.runs.includes(:game, :category, :user) endend