Ruby on Rails setup 101 @ 2020

Install Guide

Install rvm

https://github.com/rvm/rvm

1
2
3
4
5
6
7
8
9
10
11
12
13
# Install rvm
\curl -sSL https://get.rvm.io | bash -s stable

# Load source
source ~/.zshrc

# Install ruby source
brew update

# Install ruby required binaries, show process via --debug
rvm requirements --debug
# If it stuck, control + C and run this, then rvm install 2.7
brew install zlib autoconf automake coreutils zlib libyaml readline

Install Ruby @ 2.7

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
rvm install 2.7
rvm use 2.7.0 --default

# Check ruby version
ruby -v

# Check gem version
gem -v

# Install bundler (somthing like npm/yarn)
gem install bundler

# Install rails
gem install rails -v 5.2

# Check rails version
rails -v

Setup project based gemset

1
2
3
4
5
6
7
8
9
10
11
12
13
#manaully
rvm gemset create gemset1
rvm use 2.7.0@gemset1

#1 liner
rvm use 2.7.0@gemset1

#autoload
cd YOUR_PROJECT_DIR
echo "rvm use 2.7.0@gemset1" > .rvmrc

#setup api only rails
rails _6.0.0_ new . --api

Fix rails some strange default gem issues

1
2
3
4
5
6
7
8
9
10
# replece sqlite3 in your gemfile
gem 'sqlite3', '>= 1.4.2'

# replace tzinfo-data
gem 'tzinfo-data', '>= 1.2019.3'


# Fix bundler issue
gem install bundler:2.1.4
bundle _2.1.4_ update && bundle _2.1.4_ install

Online guides

Short, for experienced: https://courses.growthschool.com/p/rails-101
Long, for dig deep : https://www.learnenough.com/ruby-on-rails-6th-edition-tutorial

load it into intellj

this one doesnt work
https://www.jetbrains.com/help/idea/opening-a-rails-project-in-intellij-idea.html#

this trick works
https://stackoverflow.com/questions/31645363/intellij-ultimate-detects-ruby-on-rails-as-jruby