repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/graphql/resolvers/user_resolvers/user_resolver.rb | app/graphql/resolvers/user_resolvers/user_resolver.rb | module Resolvers
module UserResolvers
class UserResolver < Resolvers::BaseResolver
type Types::UserType, null: true
description "Find a user. May only use one argument at a time."
argument :id, ID, required: false, description: "Find a user by their ID."
argument :username, String, requi... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/graphql/resolvers/user_resolvers/list_resolver.rb | app/graphql/resolvers/user_resolvers/list_resolver.rb | module Resolvers
module UserResolvers
class ListResolver < Resolvers::BaseResolver
type Types::UserType.connection_type, null: true
description "List all users."
argument :sort_by, Types::Enums::UserSortType, required: false, description: "The order to sort the users in, if any."
def re... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/graphql/resolvers/user_resolvers/current_user_resolver.rb | app/graphql/resolvers/user_resolvers/current_user_resolver.rb | module Resolvers
module UserResolvers
class CurrentUserResolver < Resolvers::BaseResolver
type Types::UserType, null: true
description "Get the currently authenticated user."
def resolve
context[:current_user]
end
end
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/graphql/resolvers/game_resolvers/search_resolver.rb | app/graphql/resolvers/game_resolvers/search_resolver.rb | module Resolvers
module GameResolvers
class SearchResolver < Resolvers::BaseResolver
type Types::GameType.connection_type, null: true
description "Find a game by searching based on its name."
argument :query, String, required: true, description: "Name to search by."
def resolve(query:)
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/graphql/resolvers/game_resolvers/game_resolver.rb | app/graphql/resolvers/game_resolvers/game_resolver.rb | module Resolvers
module GameResolvers
class GameResolver < Resolvers::BaseResolver
type Types::GameType, null: true
description "Find a game by ID or one of its external IDs. May only use one of the filters at a time."
argument :id, ID, required: false, description: "Find a game by its unique ... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/graphql/resolvers/game_resolvers/list_resolver.rb | app/graphql/resolvers/game_resolvers/list_resolver.rb | module Resolvers
module GameResolvers
class ListResolver < Resolvers::BaseResolver
type Types::GameType.connection_type, null: true
description "List all games."
argument :sort_by, Types::Enums::GameSortType, required: false, description: "The order to sort the games in, if any."
argumen... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/graphql/resolvers/engine_resolvers/search_resolver.rb | app/graphql/resolvers/engine_resolvers/search_resolver.rb | module Resolvers
module EngineResolvers
class SearchResolver < Resolvers::BaseResolver
type Types::EngineType.connection_type, null: true
description "Find a game engine by searching based on its name."
argument :query, String, required: true, description: "Name to search by."
def resol... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/graphql/resolvers/engine_resolvers/list_resolver.rb | app/graphql/resolvers/engine_resolvers/list_resolver.rb | module Resolvers
module EngineResolvers
class ListResolver < Resolvers::BaseResolver
type Types::EngineType.connection_type, null: true
description "List all game engines."
def resolve
Engine.all
end
end
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/graphql/resolvers/engine_resolvers/engine_resolver.rb | app/graphql/resolvers/engine_resolvers/engine_resolver.rb | module Resolvers
module EngineResolvers
class EngineResolver < Resolvers::BaseResolver
type Types::EngineType, null: true
description "Find a game engine by ID."
argument :id, ID, required: true
def resolve(id:)
Engine.find(id)
end
end
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/settings_controller.rb | app/controllers/settings_controller.rb | class SettingsController < ApplicationController
before_action :authenticate_user!
# Profile things
def profile
@user = current_user
authorize @user, policy_class: SettingsPolicy
end
# Account settings
def account
@user = current_user
authorize @user, policy_class: SettingsPolicy
end
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/stores_controller.rb | app/controllers/stores_controller.rb | class StoresController < ApplicationController
before_action :authenticate_user!, except: [:index, :show]
def index
@stores = Store.order(:name).page helpers.page_param
skip_policy_scope
end
def show
@store = Store.find(params[:id])
skip_authorization
respond_to do |format|
format.h... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/home_controller.rb | app/controllers/home_controller.rb | class HomeController < ApplicationController
layout "application_no_padding"
def index
skip_policy_scope
@counts = Rails.cache.fetch("home_page_counts_#{ENV['GIT_COMMIT_SHA']}", expires_in: 30.minutes) do
{
games: Game.count,
platforms: Platform.count,
series: Series.count,
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/series_controller.rb | app/controllers/series_controller.rb | class SeriesController < ApplicationController
before_action :authenticate_user!, except: [:index, :show]
def index
@series = Series.order(:name).page helpers.page_param
skip_policy_scope
end
def show
@series = Series.find(params[:id])
skip_authorization
@games = @series.games
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/graphql_controller.rb | app/controllers/graphql_controller.rb | class GraphqlController < ApplicationController
# If the user hasn't provided any token, return a specific error message.
before_action :handle_user_not_logged_in, if: -> {
!current_user && !user_using_oauth? && !request.headers.key?('X-User-Email')
}
# Authenticate with Doorkeeper if there's no X-User-Ema... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/static_pages_controller.rb | app/controllers/static_pages_controller.rb | class StaticPagesController < ApplicationController
layout :resolve_layout
# We only need to allow this worker-src stuff on the GraphiQL
# page, no need for it to be a site-wide CSP config.
content_security_policy(only: :graphiql) do |policy|
policy.worker_src :self, :https, :blob
end
def about
sk... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/activity_controller.rb | app/controllers/activity_controller.rb | class ActivityController < ApplicationController
before_action :authenticate_user!, except: :global
def global
@events = Views::NewEvent.recently_created
.joins(:user)
.where(users: { privacy: :public_account })
.page(helper... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/engines_controller.rb | app/controllers/engines_controller.rb | class EnginesController < ApplicationController
before_action :authenticate_user!, except: [:show, :index]
def index
@engines = Engine.order(:name).page helpers.page_param
skip_policy_scope
end
def show
@engine = Engine.find(params[:id])
skip_authorization
@games = @engine.games
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/users_controller.rb | app/controllers/users_controller.rb | class UsersController < ApplicationController
def index
# Hide banned users from users that aren't moderators or admins.
if current_user&.member? || current_user.nil?
@users = User.where(banned: false)
elsif current_user&.moderator? || current_user&.admin?
@users = User.all
end
order_... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/events_controller.rb | app/controllers/events_controller.rb | class EventsController < ApplicationController
before_action :authenticate_user!
def destroy
# Run through each event type to find the event we're trying to delete here.
@event = Views::NewEvent.find_event_subclass_by_id(params[:id].to_s)
authorize @event, policy_class: EventPolicy
@event.destroy
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/relationships_controller.rb | app/controllers/relationships_controller.rb | class RelationshipsController < ApplicationController
before_action :authenticate_user!
def create
@followed = User.find(params[:user_id])
authorize @followed, policy_class: RelationshipPolicy
@relationship = Relationship.new(follower: current_user, followed: @followed)
if @relationship.save
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/genres_controller.rb | app/controllers/genres_controller.rb | class GenresController < ApplicationController
def index
@genres = Genre.order(:name).page helpers.page_param
skip_policy_scope
respond_to do |format|
format.html
format.json { render json: @genres }
end
end
def show
@genre = Genre.find(params[:id])
skip_authorization
@gam... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/game_purchases_controller.rb | app/controllers/game_purchases_controller.rb | class GamePurchasesController < ApplicationController
before_action :authenticate_user!, except: [:show, :index]
def index
@game_purchases = GamePurchase.where(user_id: params[:user_id])
.includes(:game, :platforms, :stores)
skip_policy_scope
end
def show
@game_pu... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/platforms_controller.rb | app/controllers/platforms_controller.rb | class PlatformsController < ApplicationController
before_action :authenticate_user!, except: [:index, :show]
def index
@platforms = Platform.order(:name).page helpers.page_param
skip_policy_scope
end
def show
@platform = Platform.find(params[:id])
skip_authorization
@games = @platform.gam... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/games_controller.rb | app/controllers/games_controller.rb | class GamesController < ApplicationController
before_action :authenticate_user!, except: [:show, :index]
def index
@games = Game.all
@games = @games.on_platform(params[:platform_filter]) if params[:platform_filter]
@games = @games.by_year(params[:by_year]) if params[:by_year]
order_by_sym = param... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/companies_controller.rb | app/controllers/companies_controller.rb | class CompaniesController < ApplicationController
before_action :authenticate_user!, except: [:show, :index]
def index
@companies = Company.order(:name).page(helpers.page_param)
skip_policy_scope
respond_to do |format|
format.html
format.json { render json: @companies }
end
end
def... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/admin_controller.rb | app/controllers/admin_controller.rb | class AdminController < ApplicationController
before_action :authenticate_user!
def dashboard
# We don't have anything specific to validate, so just pass nil.
authorize nil, policy_class: AdminPolicy
@counts = {
users: User.count,
games: Game.count,
platforms: Platform.count,
s... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/application_controller.rb | app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
include Pundit::Authorization
# Require a valid CSRF token, throw an exception if there isn't one.
protect_from_forgery with: :exception, unless: -> {
request.format.json?
}
# In devise-related pages, permit a username parameter.
before_action :conf... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/search_controller.rb | app/controllers/search_controller.rb | class SearchController < ApplicationController
def index
skip_policy_scope
# A list of the types of records which can be returned in the multisearch.
# Intentionally ordered so the most important types come first.
@searchable_types = %w[
Game Series Company Platform Engine Genre User
]
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/admin/unmatched_games_controller.rb | app/controllers/admin/unmatched_games_controller.rb | class Admin::UnmatchedGamesController < ApplicationController
before_action :authenticate_user!
def index
authorize nil, policy_class: Admin::UnmatchedGamesPolicy
skip_policy_scope
@unmatched_games = Views::GroupedUnmatchedGame.where(external_service_name: 'Steam')
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/oauth/authorizations_controller.rb | app/controllers/oauth/authorizations_controller.rb | class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
before_action :authenticate_resource_owner!
def new
authorize @application, policy_class: Oauth::AuthorizationPolicy
super
end
def create
authorize @application, policy_class: Oauth::AuthorizationPolicy
super
end
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/oauth/applications_controller.rb | app/controllers/oauth/applications_controller.rb | class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
before_action :authenticate_user!
# Doorkeeper tries to require that the user be an admin in order to create
# an application, so we skip it to allow 'normal' users to create OAuth
# apps.
skip_before_action :authenticate_admin!
# Onl... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/oauth/authorized_applications_controller.rb | app/controllers/oauth/authorized_applications_controller.rb | class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicationsController
before_action :authenticate_resource_owner!
def index
skip_authorization
skip_policy_scope
super
end
def destroy
skip_authorization
super
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/users/passwords_controller.rb | app/controllers/users/passwords_controller.rb | # frozen_string_literal: true
class Users::PasswordsController < Devise::PasswordsController
invisible_captcha only: [:create, :update], on_spam: :spam_callback, honeypot: :honey
# GET /resource/password/new
def new
skip_authorization
super
end
# POST /resource/password
def create
skip_author... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/users/registrations_controller.rb | app/controllers/users/registrations_controller.rb | # frozen_string_literal: true
class Users::RegistrationsController < Devise::RegistrationsController
before_action :configure_sign_up_params, only: [:create]
before_action :configure_account_update_params, only: [:update]
invisible_captcha only: [:create, :update], scope: :user, on_spam: :spam_callback, honeypot... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/users/confirmations_controller.rb | app/controllers/users/confirmations_controller.rb | # frozen_string_literal: true
class Users::ConfirmationsController < Devise::ConfirmationsController
# GET /resource/confirmation/new
def new
skip_authorization
super
end
# POST /resource/confirmation
def create
skip_authorization
super
end
# GET /resource/confirmation?confirmation_toke... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/controllers/users/sessions_controller.rb | app/controllers/users/sessions_controller.rb | # frozen_string_literal: true
class Users::SessionsController < Devise::SessionsController
invisible_captcha only: [:create, :update], scope: :user, on_spam: :spam_callback, honeypot: :honey
# GET /resource/sign_in
def new
skip_authorization
super
end
# POST /resource/sign_in
def create
skip_... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/platform.rb | app/models/platform.rb | class Platform < ApplicationRecord
include GlobalSearchable
include Searchable
has_many :game_platforms
has_many :games, through: :game_platforms, source: :game
has_many :game_purchase_platforms
has_many :game_purchases, through: :game_purchase_platforms, source: :game_purchase
has_paper_trail ignore: ... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/game_developer.rb | app/models/game_developer.rb | class GameDeveloper < ApplicationRecord
belongs_to :game
belongs_to :company
validates :game_id,
uniqueness: { scope: :company_id }
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/game_platform.rb | app/models/game_platform.rb | class GamePlatform < ApplicationRecord
belongs_to :game
belongs_to :platform
validates :game_id,
uniqueness: { scope: :platform_id }
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/wikidata_blocklist.rb | app/models/wikidata_blocklist.rb | class WikidataBlocklist < ApplicationRecord
belongs_to :user, optional: true
validates :wikidata_id,
presence: true,
uniqueness: true
validates :name,
presence: true,
length: { maximum: 120 }
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/genre.rb | app/models/genre.rb | class Genre < ApplicationRecord
include GlobalSearchable
include Searchable
has_many :game_genres
has_many :games, through: :game_genres, source: :game
has_paper_trail ignore: [:updated_at, :created_at],
versions: {
class_name: 'Versions::GenreVersion'
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/unmatched_game.rb | app/models/unmatched_game.rb | # Model for tracking games that were imported via Steam Import (and potentially
# other importers later) that couldn't be matched to a game on vglist.
class UnmatchedGame < ApplicationRecord
belongs_to :user, optional: true
# Prevent the same user from creating unmatched game records multiple times
# for the sam... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/game_publisher.rb | app/models/game_publisher.rb | class GamePublisher < ApplicationRecord
belongs_to :game
belongs_to :company
validates :game_id,
uniqueness: { scope: :company_id }
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/statistic.rb | app/models/statistic.rb | class Statistic < ApplicationRecord
STATISTICS = [
:users,
:games,
:platforms,
:series,
:engines,
:companies,
:genres,
:stores,
:events,
:game_purchases,
:relationships,
:games_with_covers,
:games_with_release_dates,
:banned_users,
:mobygames_ids,
:pcgam... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/relationship.rb | app/models/relationship.rb | class Relationship < ApplicationRecord
after_create :create_follow_event
# The user that's following the other.
belongs_to :follower, class_name: 'User'
# The user being followed.
belongs_to :followed, class_name: 'User'
has_many :relationship_events, foreign_key: :eventable_id, inverse_of: :eventable, cl... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/game.rb | app/models/game.rb | class Game < ApplicationRecord
include GlobalSearchable
include Searchable
has_many :game_purchases, dependent: :destroy
has_many :purchasers, through: :game_purchases, source: :user
has_many :game_developers
has_many :developers, through: :game_developers, source: :company
has_many :game_publishers
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/game_purchase_platform.rb | app/models/game_purchase_platform.rb | class GamePurchasePlatform < ApplicationRecord
belongs_to :game_purchase
belongs_to :platform
validates :game_purchase_id,
uniqueness: { scope: :platform_id }
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/favorite_game.rb | app/models/favorite_game.rb | class FavoriteGame < ApplicationRecord
after_create :favorite_game_create_event
belongs_to :game
belongs_to :user
has_many :favorite_game_events, foreign_key: :eventable_id, inverse_of: :eventable, class_name: 'Events::FavoriteGameEvent', dependent: :destroy
validates :user_id, uniqueness: {
scope: :ga... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/views.rb | app/models/views.rb | # Parent module for storing models represented by SQL views.
module Views
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/store.rb | app/models/store.rb | class Store < ApplicationRecord
include Searchable
has_many :game_purchase_stores
has_many :game_purchases, through: :game_purchase_stores, source: :game_purchase
validates :name,
presence: true,
length: { maximum: 120 }
searchable :name
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/steam_blocklist.rb | app/models/steam_blocklist.rb | class SteamBlocklist < ApplicationRecord
belongs_to :user, optional: true
validates :steam_app_id,
presence: true,
uniqueness: true
validates :name,
presence: true,
length: { maximum: 120 }
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/game_engine.rb | app/models/game_engine.rb | class GameEngine < ApplicationRecord
belongs_to :game
belongs_to :engine
validates :game_id,
uniqueness: { scope: :engine_id }
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/application_record.rb | app/models/application_record.rb | class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/game_purchase_store.rb | app/models/game_purchase_store.rb | class GamePurchaseStore < ApplicationRecord
belongs_to :game_purchase
belongs_to :store
validates :game_purchase_id,
uniqueness: { scope: :store_id }
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/game_purchase.rb | app/models/game_purchase.rb | class GamePurchase < ApplicationRecord
after_create :game_purchase_create
after_update :game_purchase_update
after_destroy :game_purchase_destroy
belongs_to :game
belongs_to :user
has_many :game_purchase_platforms
has_many :platforms, through: :game_purchase_platforms, source: :platform
has_many :game... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/game_genre.rb | app/models/game_genre.rb | class GameGenre < ApplicationRecord
belongs_to :game
belongs_to :genre
validates :game_id,
uniqueness: { scope: :genre_id }
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/series.rb | app/models/series.rb | class Series < ApplicationRecord
include GlobalSearchable
include Searchable
has_many :games
has_paper_trail ignore: [:updated_at, :created_at],
versions: {
class_name: 'Versions::SeriesVersion'
}
validates :name,
presence: true,
length: { max... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/engine.rb | app/models/engine.rb | class Engine < ApplicationRecord
include GlobalSearchable
include Searchable
has_many :game_engines
has_many :games, through: :game_engines, source: :game
has_paper_trail ignore: [:updated_at, :created_at],
versions: {
class_name: 'Versions::EngineVersion'
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/external_account.rb | app/models/external_account.rb | class ExternalAccount < ApplicationRecord
belongs_to :user
validates :user_id,
uniqueness: { scope: [:account_type] },
presence: true
validates :steam_id,
uniqueness: true,
allow_nil: true,
numericality: {
only_integer: true,
allow_nil: true,
greater_than: 0
}
valida... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/steam_app_id.rb | app/models/steam_app_id.rb | class SteamAppId < ApplicationRecord
belongs_to :game
validates :app_id,
uniqueness: true,
allow_nil: false,
numericality: {
only_integer: true,
allow_nil: true,
greater_than: 0
}
validate :app_id_not_blocklisted
protected
# Prevent the game from using a Steam App ID whic... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/company.rb | app/models/company.rb | class Company < ApplicationRecord
include GlobalSearchable
include Searchable
has_many :game_developers
has_many :developed_games, through: :game_developers, source: :game
has_many :game_publishers
has_many :published_games, through: :game_publishers, source: :game
has_paper_trail ignore: [:updated_at,... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/user.rb | app/models/user.rb | class User < ApplicationRecord
extend FriendlyId
include PgSearch::Model
include GlobalSearchable
include Searchable
after_create :on_user_creation
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticat... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/concerns/searchable.rb | app/models/concerns/searchable.rb | module Searchable
extend ActiveSupport::Concern
include PgSearch::Model
module ClassMethods
def searchable(*fields, tsearch: { prefix: true })
pg_search_scope :search,
against: fields,
using: {
tsearch: tsearch
}
end
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/concerns/global_searchable.rb | app/models/concerns/global_searchable.rb | module GlobalSearchable
extend ActiveSupport::Concern
include PgSearch::Model
module ClassMethods
def global_searchable(*fields)
multisearchable against: fields
end
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/paper_trail/version.rb | app/models/paper_trail/version.rb | module PaperTrail
class Version < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
include PaperTrail::VersionConcern
self.abstract_class = true
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/views/grouped_unmatched_game.rb | app/models/views/grouped_unmatched_game.rb | module Views
# A view for performantly grouping unmatched games together based on
# their external service IDs. This allows us to expose the expected data
# for the rendered table in the frontend and also sort by the count.
class GroupedUnmatchedGame < ApplicationRecord
self.table_name = 'grouped_unmatched_... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/views/new_event.rb | app/models/views/new_event.rb | module Views
# A view for aggregating data from the various events tables.
class NewEvent < ApplicationRecord
self.table_name = 'new_events'
self.primary_key = 'id'
# Readonly since this is a view and we can't edit it.
readonly
# belongs_to :eventable
belongs_to :user, inverse_of: :new_eve... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/events/relationship_event.rb | app/models/events/relationship_event.rb | module Events
class RelationshipEvent < ApplicationRecord
self.table_name = 'events_relationship_events'
belongs_to :eventable, class_name: 'Relationship'
belongs_to :user, inverse_of: :relationship_events
validates :event_category, presence: true
enum :event_category, {
following: 4
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/events/game_purchase_event.rb | app/models/events/game_purchase_event.rb | module Events
class GamePurchaseEvent < ApplicationRecord
self.table_name = 'events_game_purchase_events'
belongs_to :eventable, class_name: 'GamePurchase'
belongs_to :user, inverse_of: :game_purchase_events
validates :event_category, presence: true
enum :event_category, {
add_to_library:... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/events/user_event.rb | app/models/events/user_event.rb | module Events
class UserEvent < ApplicationRecord
self.table_name = 'events_user_events'
belongs_to :eventable, class_name: 'User'
belongs_to :user, inverse_of: :user_events
validates :event_category, presence: true
enum :event_category, {
new_user: 3
}
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/events/favorite_game_event.rb | app/models/events/favorite_game_event.rb | module Events
class FavoriteGameEvent < ApplicationRecord
self.table_name = 'events_favorite_game_events'
belongs_to :eventable, class_name: 'FavoriteGame'
belongs_to :user, inverse_of: :favorite_game_events
validates :event_category, presence: true
enum :event_category, {
favorite_game: ... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/versions/game_version.rb | app/models/versions/game_version.rb | module Versions
class GameVersion < PaperTrail::Version
self.table_name = :game_versions
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/versions/genre_version.rb | app/models/versions/genre_version.rb | module Versions
class GenreVersion < PaperTrail::Version
self.table_name = :genre_versions
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/versions/company_version.rb | app/models/versions/company_version.rb | module Versions
class CompanyVersion < PaperTrail::Version
self.table_name = :company_versions
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/versions/engine_version.rb | app/models/versions/engine_version.rb | module Versions
class EngineVersion < PaperTrail::Version
self.table_name = :engine_versions
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/versions/series_version.rb | app/models/versions/series_version.rb | module Versions
class SeriesVersion < PaperTrail::Version
self.table_name = :series_versions
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/models/versions/platform_version.rb | app/models/versions/platform_version.rb | module Versions
class PlatformVersion < PaperTrail::Version
self.table_name = :platform_versions
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/app/mailers/application_mailer.rb | app/mailers/application_mailer.rb | class ApplicationMailer < ActionMailer::Base
default from: 'noreply@mail.vglist.co'
layout 'mailer'
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds.rb | db/seeds.rb | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
require 'database_cleaner'
require 'open-uri'
puts "Cleaning out database..."
# Make sure the DB is cl... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds/game_purchases.rb | db/seeds/game_purchases.rb | puts "Creating Game Purchases..."
# Add 3 game to each user's libraries.
(1..User.count).each do |index|
# Skip occasionally to allow the database to be seeded with users that have
# empty libraries.
next if rand(3) == 1
user = User.find(index)
# Choose 3 unique random game IDs and add each to the user's l... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds/users.rb | db/seeds/users.rb | # Fetches an avatar image from Faker, or uses an image from the test suite
# if in CI, to avoid external HTTP requests.
def avatar_fetcher
if ENV['CI']
File.open('./spec/factories/images/avatar.jpg')
else
URI.parse(Faker::Image.unsplash(width: 400, height: 400)).open
end
end
puts "Creating Users..."
# C... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds/companies.rb | db/seeds/companies.rb | puts "Creating Companies..."
20.times do
Company.create!(
name: Faker::Game.unique.company,
wikidata_id: Faker::Number.unique.number(digits: 6)
)
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds/advanced_users.rb | db/seeds/advanced_users.rb | puts "Creating Advanced Users..."
# Exit early if there are less than 10 games.
return if Game.count < 10
# Seed users and then give them game purchases.
Rake::Task['db:seed:users'].invoke
Rake::Task['db:seed:game_purchases'].invoke
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds/stores.rb | db/seeds/stores.rb | puts "Creating Stores..."
# Create 10 Stores.
10.times do
Store.create!(
name: Faker::Game.unique.store
)
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds/games.rb | db/seeds/games.rb | # Fetches a cover image from LoremPixel, or uses an image from the test suite
# if in CI, to avoid external HTTP requests.
def cover_fetcher
if ENV['CI']
File.open('./spec/factories/images/crysis.jpg')
else
# TODO: Make the dimensions more random.
URI.parse(Faker::Image.unsplash(width: 560, height: 800)... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds/platforms.rb | db/seeds/platforms.rb | puts "Creating Platforms..."
# Create 20 Platforms.
20.times do
Platform.create!(
name: Faker::Game.unique.platform,
wikidata_id: Faker::Number.unique.number(digits: 6)
)
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds/engines.rb | db/seeds/engines.rb | puts "Creating Engines..."
10.times do
Engine.create!(
name: Faker::Game.unique.engine,
wikidata_id: Faker::Number.unique.number(digits: 6)
)
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds/series.rb | db/seeds/series.rb | puts "Creating Series..."
# Create 20 Series.
20.times do
Series.create!(
name: Faker::Game.unique.series,
wikidata_id: Faker::Number.unique.number(digits: 6)
)
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds/admin.rb | db/seeds/admin.rb | puts "Creating admin..."
# Create an account for admin usage.
User.create_with(
password: "password",
role: :admin
).find_or_create_by!(
email: "admin@example.com",
username: "connor"
)
admin = User.find_by!(email: "admin@example.com")
# Confirm the admin's email.
admin.confirm
# Exit early if there aren't ... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/seeds/genres.rb | db/seeds/genres.rb | puts "Creating Genres..."
# Create 20 unique genres.
20.times do
Genre.create!(
name: Faker::Game.unique.genre,
wikidata_id: Faker::Number.unique.number(digits: 6)
)
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/migrate/20220612003054_move_favorite_game_events.rb | db/migrate/20220612003054_move_favorite_game_events.rb | # Move the events records from the `events` table to the new separate tables
# per-eventable type.
class MoveFavoriteGameEvents < ActiveRecord::Migration[6.1]
def up
# rubocop:disable Rails/SkipsModelValidations
return if ActiveRecord::Base.connection.exec_query("SELECT COUNT(*) FROM events WHERE eventable_ty... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/migrate/20190817210528_add_before_after_value_columns_to_game_purchase_events.rb | db/migrate/20190817210528_add_before_after_value_columns_to_game_purchase_events.rb | class AddBeforeAfterValueColumnsToGamePurchaseEvents < ActiveRecord::Migration[6.0]
def change
change_table :game_purchase_events, bulk: true do |t|
t.text :before_value, null: true
t.text :after_value, null: true
end
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/migrate/20190516232940_add_foreign_key_to_favorite_games.rb | db/migrate/20190516232940_add_foreign_key_to_favorite_games.rb | class AddForeignKeyToFavoriteGames < ActiveRecord::Migration[5.2]
def change
add_foreign_key :favorite_games, :games, column: :game_id, on_delete: :cascade
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/migrate/20181229041436_create_games.rb | db/migrate/20181229041436_create_games.rb | class CreateGames < ActiveRecord::Migration[5.2]
def change
create_table :games do |t|
t.text :name, null: false, default: ""
t.text :description, null: false, default: ""
t.timestamps
end
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/migrate/20200709013909_create_steam_blocklist.rb | db/migrate/20200709013909_create_steam_blocklist.rb | class CreateSteamBlocklist < ActiveRecord::Migration[6.0]
def change
create_table :steam_blocklist do |t|
# Use a bigint just in case Steam ever has more than 2.1 billion titles.
t.integer :steam_app_id, null: false, limit: 5, unique: true, index: { unique: true }
t.text :name, null: false
... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/migrate/20190925024449_add_owner_to_application.rb | db/migrate/20190925024449_add_owner_to_application.rb | class AddOwnerToApplication < ActiveRecord::Migration[6.0]
def change
add_column :oauth_applications, :owner_id, :integer, null: true
add_column :oauth_applications, :owner_type, :string, null: true
add_index :oauth_applications, [:owner_id, :owner_type]
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/migrate/20190312024943_add_start_date_and_completion_date_to_game_purchases.rb | db/migrate/20190312024943_add_start_date_and_completion_date_to_game_purchases.rb | class AddStartDateAndCompletionDateToGamePurchases < ActiveRecord::Migration[5.2]
def change
change_table :game_purchases, bulk: true do |t|
t.date :start_date
t.date :completion_date
end
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/migrate/20190119025532_create_pg_search_documents.rb | db/migrate/20190119025532_create_pg_search_documents.rb | # Auto-generated migration.
# rubocop:disable all
class CreatePgSearchDocuments < ActiveRecord::Migration[5.2]
def up
say_with_time("Creating table for pg_search multisearch") do
create_table :pg_search_documents do |t|
t.text :content
t.belongs_to :searchable, polymorphic: true, index: true... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/migrate/20190305020739_add_wikidata_ids_to_series.rb | db/migrate/20190305020739_add_wikidata_ids_to_series.rb | class AddWikidataIdsToSeries < ActiveRecord::Migration[5.2]
def change
# Use a bigint just in case Wikidata ever has more than 2.1 billion items.
add_column :series, :wikidata_id, :integer, limit: 5
end
end
| ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
connorshea/vglist | https://github.com/connorshea/vglist/blob/7ff3d360e861a3e224565a7ad941228f5fd462e2/db/migrate/20190217221850_create_game_developers.rb | db/migrate/20190217221850_create_game_developers.rb | class CreateGameDevelopers < ActiveRecord::Migration[5.2]
def change
create_table :game_developers do |t|
t.references :game, null: false
t.references :company, null: false
t.timestamps
end
add_foreign_key :game_developers, :games,
on_delete: :cascade
add_foreign_key :game_de... | ruby | MIT | 7ff3d360e861a3e224565a7ad941228f5fd462e2 | 2026-01-04T17:32:52.765079Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.