This tutorial assumes that you're using Ubuntu 16.04
For goodness' sake, don't use the apt-get
approach to install ruby, use rvm
.
You just need to follow these steps:
https://github.com/rvm/ubuntu_rvm
To install:
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
$ sudo apt update
$ sudo apt install -y mongodb-org
Or in a one-line approach (to just copy/paste on your console...)
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 && echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list && sudo apt update && sudo apt install -y mongodb-org
To start:
$ sudo systemctl start mongodb
RuboCop is a Ruby static code analyzer (Software Testing I class...) and it's already configured with our defined guidelines to Ruby development.
So install it and use some extension to your favorite editor (like Sublime Linter RoboCop (needs Sublime Linter extension) or Vim Synstastic - Recommended)
$ gem install rubocop
Some of the most important parts to develop in Ruby on Rails...
$ gem install rails
You'll use this only to create personal applications or to study, in case that our main project is already configured, so your work will be just to install dependencies with bundle
. But, for learning proposals...
$ rails new project_name --skip-active-record
After that, enter on your project folder and add this line to Gemfile
(you can put before groups)
gem 'mongoid', '~> 6.0'
To install and reconfigure project, run (on project folder, of course):
$ bundle
$ rails generate mongoid:config
All done, your Ruby on Rails is already configured to use MongoDB instead SQLite. And you can just run rails server
to see it in action.