Getting Started with Ruby On Rails


Earlier this month, I have prepared an introduction to Ruby on Rails for beginners. Here is what I have advised them.

Feel free to comment, add information or ask for more!

Ruby on Rails is a popular framework to develop web applications quickly with tremendous easiness.
But where to get started?

First, some introduction to what is Ruby On Rails and what it can achieve.
http://www.tutorialspoint.com/ruby-on-rails/rails-introduction.htm

A little bit of Ruby practice could be useful.
http://tryruby.org
https://rubymonk.com/
http://www.codecademy.com/tracks/ruby
Ruby is pretty easy and well done, so it comes quickly naturally.

Getting to know Ruby on Rails:
– Really well done website: http://railsforzombies.org/
Practice and learn for a while online before/while installing
– Read some guides: http://guides.rubyonrails.org/

Then, installing Ruby on Rails on a local machine
There are many solution in order to achieve this.
An obvious one: http://rubyonrails.org/download

My favorite solution is with RVM which will allow to manage easily multiple versions of Ruby through time.
– install RVM http://rvm.io/
– install Ruby with RVM
– install Rails as a gem

My script on Unix:

#!/bin/sh

# Install Ruby Version Manager
\curl -L https://get.rvm.io | bash -s stable

source ~/.bashrc

# Ruby

rvm install 1.9.3
rvm alias create default ruby-1.9.3-p484

rvm rubygems current
source ~/.rvm/scripts/rvm

# Rails
gem install rails

Note : the following will be probably needed:
– a database (SQLite, Postgresql, MySQL, Mongo…)
– a versioning system, like git

A server for development won’t be needed at first, as it comes with Rails. Later, a production server will be needed to be set up, but this is another story.

Now, it is time to apply what have been learnt and create a first Rails application. An ultra quick step by step tutorial:

# Create an application
rails my_game
cd my_game

# Create a first resource
rails generate scaffold HighScore game:string score:integer

# run the development server
rails s

Popular gems:
Gems are libraries for Ruby developed by worldwide contributors. They are easy to install. Some gems are already included when a new Rails application is created, such as SASS and Coffeescript.

These are my favorite gems to complete the starting package, if needed:

# Gemfile
# Write views in HAML
gem 'haml'
gem 'haml-rails'

# Better errors and console to debug in web
group :development do
gem "better_errors"
gem "binding_of_caller"
end

# pagination
gem 'will_paginate', '~> 3.0'
gem 'will_paginate-bootstrap'

# authentification
gem 'devise'

# authorizations
gem 'cancan'

# social login
gem 'omniauth'

# File upload
gem 'carrierwave'

And this should be it for a beginner to start enjoying Ruby On Rails

As a conclusion, extremely useful resources:
http://railscasts.com/ : Ryan Bates teaches everything essential to get started with Rails, with screencasts and nice narration.
http://apidock.com/ : Ruby and Rails API.

Fab
Latest posts by Fab (see all)

About Fab

Solutions Architect, I build great workflows for the news and media production industries. I play with data too.

Leave a comment

Your email address will not be published. Required fields are marked *