Rails Cheatsheet
Fri 19/03/2021
Rails
Creating a new project for the first time
Make sure to install postgresql for your system: Ubuntu: https://www.postgresql.org/download/linux/ubuntu/ Mac: https://www.postgresql.org/download/macosx/ WSL: https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-database
Select your version of Ruby using either rvm or rbenv. I'll be using Ruby v3.0.0.
Select the compatible version of Node usingnvm At the time of writing, this is v14.6.0.
Node v15.11.0 has issues with Ruby v3.0.0. and Rails v6.1.3
Create a new project with rails new [name] -T -d=postgresql
Rails comes with the testing framework "Mini Test" by default. The -T tells Rails not to include Mini Test.
Rails will create a new Rails app with sqlite3, if you don't specify the database used. Specify postgresql with -d=postgresql
Issues with creating new projust
Change the Gemfile pg version to the lastest here: https://rubygems.org/gems/pg/versions At the time of writing, it was pg v1.2.3
Run bundle binstubs bundler
Run rails webpacker:install