Start a new Rails app (v6)

Go to my code/active folder

cd ~/code/active

Create the Rails app with postgres

Also use -T to prevent rails from installing the default Testing framework (assuming I want to use RSpec)

rails new projectname --database=postgresql -T

cd to the project directory

cd projectname

Create the database

rails db:create

Open the project in Sublime Text, then save it as a Project to reopen later

Open the current project in Sublime:

subl -a "$PWD"

One the project is open in Sublime, go to Project > Save Project as..., then save this project in ~/code/Sublime Text Projects.

Initialize Git

git init
git add .
git commit -m "initial commit"

Set up the repository in GitHub

  1. Log into my github.com account

  2. "Create New Repository"

  3. Name it the same as my projectname

  4. Get commands from the instructions under "...or push an existing repository from the command line."

  5. Refresh github. I should now see all my project files shown in github.

Save this database in my db viewer on Mac (TablePlus)

host: localhost username: briancasel password: emma database_name: Find this in config/database.yml around line #26 port: 5432

Install Hotwire (turbo JS + stimulus JS)

Add this to the gemfile, then run bundle

gem 'hotwire-rails'

Then run:

rails hotwire:install

In the application head, update these lines from turbolinks to turbo so that they read like this:

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbo-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbo-track': 'reload' %>

Last updated