August 01, 2017
I wrote this step-by-step to help me remember it next time I create an app.
It’s my first time experimenting with Rails. I wanted to use a virtual environment from the start because that’s how I learned Python-Django too, and to not be afraid of setting things up.
This guide might grow as I learn more details of the process. For example, at this point I’m not sure how updates to the system Ruby version would affect the project.
I’m using Ubuntu 16.10.
$ rvm gemset create <name>
      $ rvm @<name>
      $ rvm gemset list
gemsets for ruby-2.4.0 (found in /home/felipe/.rvm/gems/ruby-2.4.0)
   (default)
   global
=> learn_rails
      $ gem install rails
      $ rails --version
Rails 5.1.X
      $ rails new blog
$ cd blog
      $ bin/rails server
      @learn_rails/gems/bundler-1.15.3/lib/bundler/runtime.rb:85:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
      A JS runtime was missing. So I went to blog/Gemfile and uncommented line 20:
gem 'therubyracer', platforms: :ruby/
      Then installed the new gem.
$ bundle install
Bundle complete! 17 Gemfile dependencies, 73 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
      Now the server ran fine:
$ bin/rails server
      Browse to: http://localhost:3000
All set!
Written by Felipe Freitag who lives and works in Porto Alegre, coding and drawing. Follow on twitter