Skip to content

Instantly share code, notes, and snippets.

View sharkey11's full-sized avatar

Jack Sharkey sharkey11

View GitHub Profile
@sharkey11
sharkey11 / missing_fks.rb
Last active November 29, 2023 00:07
This script will look through your Schema and find any "foreign key" columns that are missing actual DB foreign keys. This could lead to orphaned rows and dirty data.
# Parse and identify potential foreign key issues in a Rails schema.rb file.
# TO USE THIS, SAVE THE FILE AND RUN IT USING RAILS RUNNER. EXAMPLE:
# `rails runner missing_fks.rb`
def extract_table_names(schema_lines)
schema_lines.select { |line| line.strip.start_with?('create_table') }
.map { |line| line.split('"')[1] }
end
@sharkey11
sharkey11 / RailsAdminDashboard.md
Last active September 23, 2024 23:06
This is context for an LLM to make a rails admin dashboard

Building an admin dashboard

Our ruby on rails app contains an admin dashboard that lives on /admin. The admin dashboard allows users to interact with our database or features. Often times, when a feature is built, an admin dashboard will be made. The admin dashboard will often allow a user to read the data and/or write data back to the database.

The practice of building an admin dashboard is very repeatable. I will list out the example steps for a process for a feature known as the wheel.

Procedure

Your job is to understand this pattern and build an admin dashboard pull request. I will provide some inputs such as:

  • Database table name:
  • Tab category: