• Creating One-to-Many Association in Rails

    Intro Quick reminder about creating a one-to-many relationship/association. What did I already know I knew that I needed to put both sides of the relationship into their respective models. The Team model needs has_many :players, and the Player model needs belongs_to :team. A migration would be needed; and that there...
  • Connect Js With Importmaps Rails7

    There was a disconnect between the documentation and the various StackOverflow and Google searches regarding this subject. So I’m writing this article. Intro This article assumes a couple of things: Using an (existing) Rails 7 project - I did this with rails v 7.0.8 The app was created using the...
  • Basic Devise setup in Rails 7 (no OmniAuth of any type)

    This article is written with the expectation that ViewComponents are being used When I have a new rails app that’s been created with a root route in the routes.rb file, I’m ready to create users. Here’s the steps needed to add Authentication using Devise in a Rails 7 app. Add...
  • Creating a Controller, an Action and a Root path in a Rails 7 app

    Creating a Rails 7 app is an easy thing to do from the command line. rails new devise-practice-1 After it’s been created, starting the rails server is also very easy to do. cd devise-practice-1 rails s This spins up the server (which is enabled by the software called Puma; You...
  • Turbo Streams are so cool!

    Table of Contents Setup In The Controller In The Turbo Stream ERB file Additional Stuff Conclusion Setup To use Turbo streams, do the following: In a view, add a turbo_frame_tag like so: <%= turbo_frame_tag "some_name_for_the_frame" do %> # additional html/erb code can be added here, but it will be #...
  • Git Rebasing

    Learning How Git Rebase works Git is a massive tool. Generally, this is how I usually use git: I start on the main branch on my local machine Create a new branch Do some work git add git commit -m ‘some commit message’ Repeat steps 3 through 5 git pull...
  • Sidekiq + Redis + Background Jobs (aka workers)

    ToC Intro What is Sidekiq When is Sidekiq in action Why use Sidekiq Conclusion Intro This is about Sidekiq. What it is, when it is in action, and why it’s used. To get everything you need from this article you should have a basic understanding of: a typical HTTP request/response...
  • How To Make A File Or Csv With Ruby

    How to write to a File or CSV file in Ruby ToC Introduction Create a File Write to a File Now With CSV Conclusion Introduction Many, many times I’ve wanted to write a quick and dirty Ruby script that drops some data into a file. Too many times I’ve looked...