Setup Rails
Before setting up rails, you will need to ensure you have versioning tool installed.
- similar to nvm for node, rbenv for ruby, etc
Versioning Tools
If you understand how to setup your local environments with different versions for different languages/frameworks, you can continue to use them. Some examples:
asdfrbenvmise
If this is the first time you are hearing about versioning tools like asdf, rbenv, etc, or have not used any versioning tools before, recommend using mise.
Installing Rails
- Follow this tutorial to install:
- mise
- ruby 3.3.5
- rails 8.0.1
- Ensure you are able to have a running rails server for an api only rails app
-
Read more here: https://guides.rubyonrails.org/api_app.html
-
Commands
rails new rails-onboarding --api -d mysqlrails start(localhost:3000)
-
If you want to try stuff out on your own, you can create another rails project with a different name
rails new tutorial --api -d mysql
Database
If you do not have mysql installed, install 8.4.
If you already have mysql installed, ensure it is at least version 8.x
gorails tutorial shows how to install mysql
VS Code Extensions
Download VS Code and the following extensions:
- Ruby LSP (Shopify)
- ensure you can ctrl+click on a class and it will take you to the file
- hover will show the method signatures
- Rails DB Schema
- ensure you can ctrl+click on a table and it will take you to the file
- Auto Close Tag
- endwise
- LiveShare
VS Code Setup
- launch.json
- settings.json
- Make sure the linting and suggestions is working
Ruby (Language Support)
- rubocop