Install Ruby on Rails – Ubuntu Linux

Install Ruby on Rails 4.1 on Ubuntu Linux. Up-to-date, detailed instructions for the Rails newest release. How to install Rails 4.1, the newest version of Rails, on Ubuntu.

This in-depth installation guide is used by developers to configure their working environment for real-world Rails development. This guide doesn’t cover installation of Ruby on Rails for a production server.

To develop with Rails on Ubuntu, you’ll need Ruby (an interpreter for the Ruby programming language) plus gems (software libraries) containing the Rails web application development framework.

For an overview of what’s changed in each Rails release, see a Ruby on Rails Release History.

What is the RailsApps Project?

This is an article from the RailsApps project. The RailsApps project provides example applications that developers use as starter apps. Hundreds of developers use the apps, report problems as they arise, and propose solutions. Rails changes frequently; each application is known to work and serves as your personal “reference implementation.” Support for the project comes from subscribers. If this article is useful, please support us and join the RailsApps project.

Ruby on Rails on Ubuntu

Ubuntu is a popular platform for Rails development, as are other Unix-based operating systems such as Mac OS X. Installation is relatively easy and widespread help is available in the Rails developer community.

Use a Ruby Version Manager

You’ll need an easy way to switch between Ruby versions. Just as important, you’ll have a dependency mess if you install gems into the system environment. I recommend RVM to manage Ruby versions and gems because it is popular, well-supported, and full-featured. If you are an experienced Unix administrator, you can consider alternatives such as Chruby, Sam Stephenson’s rbenv, or others on this list.

Conveniently, you can use RVM to install Ruby.

Don’t Install Ruby from a Package

Ubuntu provides a package manager system for installing system software. You’ll use this to prepare your computer before installing Ruby. However, don’t use apt-get to install Ruby. The package manager will install an outdated version of Ruby. And it will install Ruby at the system level (for all users). It’s better to use RVM to install Ruby within your user environment.

Hosted Development

You can use Ruby on Rails without actually installing it on your computer. Hosted development, using a service such as Nitrous.io, means you get a computer “in the cloud” that you use from your web browser. Any computer can access the hosted development environment, though you’ll need a broadband connection. Nitrous.io is free for small projects.

Using a hosted environment means you are no longer dependent on the physical presence of a computer that stores all your files. If your computer crashes or is stolen, you can continue to use your hosted environment from any other computer. Likewise, if you frequently work on more than one computer, a hosted environment eliminates the difficulty of maintaining duplicate development environments. For these reasons some developers prefer to “work in the cloud” using Nitrous.io. For more on Nitrous.io, see the article Ruby on Rails with Nitrous.io. Nitrous.io is a good option if you have trouble installing Ruby on Rails on your computer.

Prepare Your System

You’ll need to prepare your computer with the required system software before installing Ruby on Rails.

You’ll need superuser (root) access to update the system software.

Update your package manager first:

$ sudo apt-get update

This must finish without error or the following step will fail.

Install Curl:

$ sudo apt-get install curl

You’ll use Curl for installing RVM.

Install Ruby Using RVM

Use RVM, the Ruby Version Manager, to install Ruby and manage your Rails versions.

If you have an older version of Ruby installed on your computer, there’s no need to remove it. RVM will leave your “system Ruby” untouched and use your shell to intercept any calls to Ruby. Any older Ruby versions will remain on your system and the RVM version will take precedence.

Ruby 2.1.1 was current when this was written. You can check for the current recommended version of Ruby. RVM will install the newest stable Ruby version.

The RVM website explains how to install RVM. Here’s the simplest way:

$ \curl -L https://get.rvm.io | bash -s stable --ruby

Note the backslash before “curl” (this avoids potential version conflicts).

The “—ruby” flag will install the newest version of Ruby.

RVM includes an “autolibs” option to identify and install system software needed for your operating system. See the article RVM Autolibs: Automatic Dependency Handling and Ruby 2.0 for more information.

If You Already Have RVM Installed

If you already have RVM installed, update it to the latest version and install Ruby:

$ rvm get stable --autolibs=enable
$ rvm install ruby
$ rvm --default use ruby-2.1.1

Installation Troubleshooting and Advice

RVM Troubleshooting

If you have trouble installing Ruby with RVM, you can get help directly from the RVM team using the IRC (Internet Relay Chat) channel #rvm on irc.freenode.net:

http://webchat.freenode.net/?channels=rvm

If you’ve never used IRC, it’s worthwhile to figure out how to use IRC because the RVM team is helpful and friendly. IRC on freenode requires registration (see how to register).

Install Node.js

Since Rails 3.1, a JavaScript runtime has been needed for development on Ubuntu Linux. The JavaScript runtime is required to compile code for the Rails asset pipeline. For development on Ubuntu Linux it is best to install the Node.js server-side JavaScript environment.

$ sudo apt-get install nodejs

and set it in your $PATH.

If you don’t install Node.js, you’ll need to add this to the Gemfile for each Rails application you build:

gem 'therubyracer'

Check the Gem Manager

RubyGems is the gem manager in Ruby.

Check the installed gem manager version:

$ gem -v
2.2.2

You should have:

Use gem update --system to upgrade the Ruby gem manager if necessary.

RVM Gemsets

Not all Rails developers use RVM to manage gems, but many recommend it.

Display a list of gemsets:

$ rvm gemset list

gemsets for ruby-2.1.1
=> (default)
   global

Only the “default” and “global” gemsets are pre-installed.

If you get an error “rvm is not a function,” close your console and open it again.

RVM’s Global Gemset

See what gems are installed in the “global” gemset:

$ rvm gemset use global
$ gem list

A trouble-free development environment requires the newest versions of the default gems.

Several gems are installed with Ruby or the RVM default gemset:

To get a list of gems that are outdated:

$ gem outdated
### list not shown for brevity

To update all stale gems:

$ gem update
### list not shown for brevity

In particular, rake should be updated to version 10.2.1 or newer.

Faster Gem Installation

By default, when you install gems, documentation files will be installed. Developers seldom use gem documentation files (they’ll browse the web instead). Installing gem documentation files takes time, so many developers like to toggle the default so no documentation is installed.

Here’s how to speed up gem installation by disabling the documentation step:

$ echo "gem: --no-document" >> ~/.gemrc

This adds the line gem: --no-document to the hidden .gemrc file in your home directory.

Staying Informed

You can stay informed of new gem versions by creating an account at RubyGems.org and visiting your dashboard. Search for each gem you use and “subscribe” to see a feed of updates in the dashboard (an RSS feed is available from the dashboard).

After you’ve built an application and set up a GitHub repository, you can stay informed with Gemnasium or VersionEye. These services survey your GitHub repo and send email notifications when gem versions change. Gemnasium and VersionEye are free for public repositories with a premium plan for private repositories.

Rails Installation Options

Check for the current version of Rails. Rails 4.1.0.rc2 is the newest pre-release version of Rails. Rails 4.0.4 is the current stable release.

You can install Rails directly into the global gemset. However, many developers prefer to keep the global gemset sparse and install Rails into project-specific gemsets, so each project has the appropriate version of Rails.

If you install Rails at this point, you will install it into the global gemset.

Instead, make a gemset just for the pre-release version of Rails:

$ rvm use ruby-2.1.1@rails4.1 --create

Or, if you want to stay with the current stable release:

$ rvm use ruby-2.1.1@rails4.0 --create

Here are the options you have for installing Rails.

If you want the newest beta version or release candidate, you can install with --pre.

$ gem install rails --pre
$ rails -v

If you want the most recent stable release:

$ gem install rails
$ rails -v

Or you can get a specific version.

For example, if you want the Rails 3.2.17 release:

$ gem install rails --version=3.2.17
$ rails -v

Create a Workspace Folder

You’ll need a convenient folder to store your Rails projects. You can give it any name, such as code/ or projects/. For this tutorial, we’ll call itworkspace/.

Create a projects folder and move into the folder:

$ mkdir workspace
$ cd workspace

This is where you’ll create your Rails applications.

New Rails Application

Here’s how to create a project-specific gemset, installing Rails, and creating a new application.

$ mkdir myapp
$ cd myapp
$ rvm use ruby-2.1.1@myapp --ruby-version --create
$ gem install rails --pre
$ rails new .

We’ll name the new application “myapp.” Obviously, you can give it any name you like.

With this workflow, you’ll first create a root directory for your application, then move into the new directory.

With one command you’ll create a new project-specific gemset. The option “—ruby-version” creates .ruby-version and .ruby-gemset files in the root directory. RVM recognizes these files in an application’s root directory and loads the required version of Ruby and the correct gemset whenever you enter the directory.

When we create the gemset, it will be empty (though it inherits use of all the gems in the global gemset). We immediately install Rails. The commandgem install rails installs the most recent release of Rails.

Finally we run rails new .. We use the Unix “dot” convention to refer to the current directory. This assigns the name of the directory to the new application.

This approach is different from the way most beginners are taught to create a Rails application. Most instructions suggest using rails new myapp to generate a new application and then enter the directory to begin work. Our approach makes it easy to create a project-specific gemset and install Rails before the application is created.

The rails new command generates the default Rails starter app. If you wish, you can use the Rails Composer tool to generate a starter application with a choice of basic features and popular gems.

Quick Test

For a “smoke test” to see if everything runs, display a list of Rake tasks.

$ rake -T

There’s no need to run bundle exec rake instead of rake when you are using RVM (see RVM and bundler integration).

This concludes the instructions for installing Ruby and Rails. Read on for additional advice and tips.

Rails Starter Apps

The starter application you create with rails new is very basic.

Use the Rails Composer tool to build a full-featured Rails starter app.

You’ll get a choice of starter applications with basic features and popular gems.

Here’s how to generate a new Rails application using the Rails Composer tool:

Using the conventional approach:

$ rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb

Or, first creating an empty application root directory:

$ mkdir myapp
$ cd myapp
$ rvm use ruby-2.1.1@myapp --ruby-version --create
$ gem install rails
$ rails new . -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb

The -m option loads an application template that is hosted on GitHub.

You can add the -T flags to skip Test::Unit if you are using RSpec for testing.

You can add the -O flags to skip Active Record if you are using a NoSQL datastore such as MongoDB.

If you get an error “OpenSSL certificate verify failed” when you try to generate a new Rails app, see the article OpenSSL errors and Rails.

Rails Tutorials and Example Applications

The RailsApps project provides example apps that show how real-world Rails applications are built. Each example is known to work and can serve as your personal “reference implementation”. Each is an open source project. Dozens of developers use the apps, report problems as they arise, and propose solutions as GitHub issues. Purchasing a subscription for the tutorials gives the project financial support.

Example Applications for Rails 4.1 Tutorial Comments
Rails and Bootstrap Tutorial starter app for Rails and Bootstrap
Rails and Foundation Quickstart Guide starter app for Rails and Zurb Foundation
OmniAuth and Rails OmniAuth for authentication
Devise and Rails Devise for authentication
Devise and Pundit and Rails Pundit for authorization
Example Applications for Rails 4.0 Tutorial Comments
Learn Rails Learn Ruby on Rails introduction to Rails for beginners

Adding a Gemset to an Existing Application

If you’ve already created an application with the command rails new myapp, you can still create a project-specific gemset. Here’s how to create a gemset for an application named “myapp” and create .ruby-version and .ruby-gemset files in the application’s root directory:

$ rvm use ruby-2.1.1@myapp --ruby-version --create

You’ll need to install Rails and the gems listed in your Gemfile into the new gemset by running:

$ gem install rails
$ bundle install

Specifying a Gemset for an Existing Application

If you have already created both an application and a gemset, but not .ruby-version and .ruby-gemset files, here’s how to add the files. For example, if you want to use an existing gemset named “ruby-2.1.1@myapp”:

$ echo "ruby-2.1.1" > .ruby-version
$ echo "myapp" > .ruby-gemset

Using .ruby-version and .ruby-gemset files means you’ll automatically be using the correct Rails and gem version when you switch to your application root directory on your local machine.

Databases for Rails

Rails uses the SQLite database by default. RVM installs SQLite and there’s nothing to configure.

Though SQLite is adequate for development (and even some production applications), a new Rails application can be configured for other databases. The command rails new myapp --database= will show you a list of supported databases.

Supported for preconfiguration are: mysql, oracle, postgresql, sqlite3, frontbase, ibm_db, sqlserver, jdbcmysql, jdbcsqlite3, jdbcpostgresql, jdbc.

For example, to create a new Rails application to use PostgreSQL:

$ rails new myapp --database=postgresql

The --database=postgresql parameter will add the pg database adapter gem to the Gemfile and create a suitable config/database.yml file.

Don’t use the --database= argument with the Rails Composer tool. You’ll select a database from a menu instead.

Deployment

If you wish to run your own servers, you can deploy a Rails application using Capistrano deployment scripts. However, unless system administration is a personal passion, it is much easier to deploy your application with a “platform as a service” provider such as Heroku.

Hosting

For easy deployment, use a “platform as a service” provider such as:

For deployment on Heroku, see the article:

Security

By design, Rails encourages practices that avoid common web application vulnerabilities. The Rails security team actively investigates and patches vulnerabilities. If you use the most current version of Rails, you will be protected from known vulnerabilities. See the Ruby On Rails Security Guide for an overview of potential issues and watch the Ruby on Rails Security Mailing List for announcements and discussion.

Your Application’s Secret Token

Rails uses a session store to provide persistence between page requests. The default session store uses cookies. To prevent decoding of cookie data and hijacking a session, Rails encrypts cookie data using a secret key. When you create a new Rails application using the rails new command, a unique secret key is generated. If you’ve used the Rails Composer tool to generate the application, the application’s secret token will be unique, just as with any Rails application generated with the rails new command.

In Rails 4.1, the file config/secrets.yml contains secret tokens for development and production.

In Rails 4.0, the config/initializers/secret_token.rb file contains the secret token.

Take care to hide the secret token you use in production. Don’t expose it in a public GitHub repo, or people could change their session information, and potentially access your site without permission. It’s best to set the secret token in a Unix shell variable.

If you need to create a new secret token:

$ rake secret

The command rake secret generates a new random secret you can use. The command won’t install the key; you have to copy the key from the console output to the appropriate file.

Where to Get Help

Your best source for help with problems is Stack Overflow. Your issue may have been encountered and addressed by others.

You can also try Rails Hotline, a free telephone hotline for Rails help staffed by volunteers.

Five Popular Ruby on Rails Based CMS

The open source content management system (CMS) market is pretty much dominated by PHP-based CMS like WordPress, Joomla! and Drupal. While PHP has its advantages, the more modern Ruby language and the highly productive framework Rails, are becoming popular choices among web developers. And in the Ruby on Rails world, there are already some good Rails based CMS projects to choose from.

Typically, with a powerful framework such as Rails, it’s easy to create a basic Rails app with CMS-like functionality, where content can easily be edited. And with Rails-based CMS, it’s easier to provide commonly requested CMS functions at the same time extend and add features for websites of small to medium sized businesses.

In this blog, I’ll go over the five prominent content management systems built in Rails (based from The Ruby Toolbox rating) and I’ll share some reviews of our Ruby on Rails developers on these CMS.

Refinery CMS

RefineryCMS has the highest popularity rating in Ruby Toolbox, garnering the highest number of downloads (almost 200,000 ruby gem downloads) and number of watchers and forks in Github. Built by Resolve Digital, Refinery is a Ruby on Rails CMS that supports the latest version of Rails, Rails 3.2.

You can check out a showcase of Refinery built websites here: http://refinerycms.com/showcase

What our RoR devs like about it: Rails 3 support; modular; easy to integrate into existing rails project; CMS features/components modularized into gems; mountable as a Rails engine; supports alternative WYSIWYG editors; supports Disqus comments; clean interface; easily extensible

Areas for improvement: no custom themes (need to create themes via layouts within the rails code)

BrowserCMS

With 77,000+ downloads, BrowserCMS is now the second most popular CMS written in Rails according to Ruby Toolbox. It is described as a general purpose, open source web content management system (CMS) that supports Ruby on Rails v3.2. It’s key features include: support for large teams of editors with variable permissions, direct in context editing, design friendly templates, sitemap, content library, content API, section based security, workflow and page caching.

What our RoR devs like about it: extensible using different modules; offers mobile ready template

Areas for improvement: few extensions compared with Radiant

LocomotiveCMS

Locomotive is a next generation CMS system with sexy admin tools, liquid templating, and inline editing powered by MongoDB and Rails3 according to Rubygems.org.

What our RoR devs like about it: Very customizable (custom attributes, fields, page types) this owing to the MongoDB schema

Areas for improvement: Tightly coupled with MongoDB, not readily available for other DBs; separate (though optional) non-free editor tool

Radiant CMS

Radiant CMS is the oldest Rails and is ideal for small teams. Featuring an elegant user interface, flexible templating with layouts, snippets, page parts, and a custom tagging language, first-class extension/plugin system and simple user management and permission, it has 70,000+ downloads and an active community.

What our RoR devs like about it: Quick to build template; multi-site configuration (via an extension); large number of extensions contributed by the community; contains User Management & Roles; built in page caching & Radius Template Language

Areas for improvement: Behind on the Rails version; extending the CMS core feels patchy; a lot of extensions do not work on succeeding versions

Adva CMS

Adva CMS is known to be as the first completely engine-based CMS platform for Rails. A new version which was named as Adva CMS2 is a completely rewrite of Adva CMS based on Rails 3.

What our RoR devs like about it: customizable, you can plug in different engines, supports building multiple sites

Areas for improvement: no support for Rails 3 until Adva CMS2 which is currently in an “early developer sneak-peak preview stage”

Other Rails based CMS which is not on the list but are also becoming popular according to Ruby Toolbox include: Comfortable Mexican Sofa, Nesta, Railsyard CMS, Skyline and Static. You can also check out other active Rails CMS projects in Github.

 (from http://www.exist.com/blog/five-popular-ruby-rails-based-cms)

The open source content management system (CMS) market is pretty much dominated by PHP-based CMS like WordPress, Joomla! and Drupal. While PHP has its advantages, the more modern Ruby language and the highly productive framework Rails, are becoming popular choices among web developers. And in the Ruby on Rails world, there are already some good Rails based CMS projects to choose from.

Typically, with a powerful framework such as Rails, it’s easy to create a basic Rails app with CMS-like functionality, where content can easily be edited. And with Rails-based CMS, it’s easier to provide commonly requested CMS functions at the same time extend and add features for websites of small to medium sized businesses.

In this blog, I’ll go over the five prominent content management systems built in Rails (based from The Ruby Toolbox rating) and I’ll share some reviews of our Ruby on Rails developers on these CMS.

Refinery CMS

Ruby on Rails CMS Development

RefineryCMS has the highest popularity rating in Ruby Toolbox, garnering the highest number of downloads (almost 200,000 ruby gem downloads) and number of watchers and forks in Github. Built by Resolve Digital, Refinery is a Ruby on Rails CMS that supports the latest version of Rails, Rails 3.2.

You can check out a showcase of Refinery built websites here: http://refinerycms.com/showcase

What our RoR devs like about it: Rails 3 support; modular; easy to integrate into existing rails project; CMS features/components modularized into gems; mountable as a Rails engine; supports alternative WYSIWYG editors; supports Disqus comments; clean interface; easily extensible

Areas for improvement: no custom themes (need to create themes via layouts within the rails code)

BrowserCMS

Custom Rails CMS Development

With 77,000+ downloads, BrowserCMS is now the second most popular CMS written in Rails according to Ruby Toolbox. It is described as a general purpose, open source web content management system (CMS) that supports Ruby on Rails v3.2. It’s key features include: support for large teams of editors with variable permissions, direct in context editing, design friendly templates, sitemap, content library, content API, section based security, workflow and page caching.

What our RoR devs like about it: extensible using different modules; offers mobile ready template

Areas for improvement: few extensions compared with Radiant

LocomotiveCMS

Rails CMS customization

Locomotive is a next generation CMS system with sexy admin tools, liquid templating, and inline editing powered by MongoDB and Rails3 according to Rubygems.org.

What our RoR devs like about it: Very customizable (custom attributes, fields, page types) this owing to the MongoDB schema

Areas for improvement: Tightly coupled with MongoDB, not readily available for other DBs; separate (though optional) non-free editor tool

Radiant CMS

customized version of Radiant CMS

Radiant CMS is the oldest Rails and is ideal for small teams. Featuring an elegant user interface, flexible templating with layouts, snippets, page parts, and a custom tagging language, first-class extension/plugin system and simple user management and permission, it has 70,000+ downloads and an active community.

What our RoR devs like about it: Quick to build template; multi-site configuration (via an extension); large number of extensions contributed by the community; contains User Management & Roles; built in page caching & Radius Template Language

Areas for improvement: Behind on the Rails version; extending the CMS core feels patchy; a lot of extensions do not work on succeeding versions

Adva CMS

RoR CMS Development

Adva CMS is known to be as the first completely engine-based CMS platform for Rails. A new version which was named as Adva CMS2 is a completely rewrite of Adva CMS based on Rails 3.

What our RoR devs like about it: customizable, you can plug in different engines, supports building multiple sites

Areas for improvement: no support for Rails 3 until Adva CMS2 which is currently in an “early developer sneak-peak preview stage”

 

Other Rails based CMS which is not on the list but are also becoming popular according to Ruby Toolbox include: Comfortable Mexican Sofa, Nesta, Railsyard CMS, Skyline and Static. You can also check out other active Rails CMS projects in Github.

20 Reasons Why Every Web Designer Needs to Learn Rails

20Reasons

She told me her husband was being downsized. He was 52 years old, been with the company for twenty. He was a COBOL man. Nothing but a COBOL man his entire career. But the company needed more than a COBOL man. So they let him go.

That is a true story. It’s about ten years old. But it’s not an uncommon story, especially in today’s rapidly-changing tech environment and somewhat dismal economy.

In fact, you probably know somebody that’s been let go or overlooked because of a lack in a certain skill set. The only difference is that you don’t have to wait until your early fifties to get downsized.

Today that can happen at 30. Even 25.

Enter Ruby on Rails

Typically the guy or gal with the most developing tools under their belt wins. It leads to the sweetest projects. The most perks. The best salary.

This is where Ruby on Rails (RoR)—and learning the framework—comes in. If you’ve been building websites for long you have no doubt heard about RoR. It’s a full-stack framework that covers both front and back end design. It’s at the heart of sites like Twitter, 43Things and Basecamp. Major Brands like Amazon and eBay even have RoR projects. And in the hands of a versatile developer RoR is a potent tool. Let me show you how.

1. Stalled Career

I don’t care how old you are. An old dog can learn new tricks. An old dog NEEDS to learn new tricks if he wants to stay current, marketable and in demand.

If your current job has hit a snag and you find yourself bored (and maybe even threatened with a layoff), then taking the time to learn Ruby on Rails may be just the thing you need to put a jolt back into your step. And give your boss something to think about.

2. Tired of Other People Getting Hired

Don’t you hate it—going through the interview process only to find out that someone else was picked instead of you? It could’ve been for a promotion at your current job or at a new company.

What’s worse is when you are job hunting and you stumble across dozens of opportunities (regarding the demand for Ruby developers, see no. 16)—but you aren’t qualified for because they want RoR experience and you don’t have it. That’s not a good feeling.

3. Bored

If you are like me, then you are unapologetically curious, incorrigibly creative and easily bored. This probably also means you are super-duper smart, hyper competitive and a sucker for a good challenge.

Learning Ruby on Rails just might be what you need right now. And why not—it’s a heck of an effective way to kill time.

4. Get More Things Done

The language (Ruby) on the framework (Rails) means that you can accomplish more with less, better structured code. Since code can be re-used changes are easy, making iteration and experimentation painless. Learning Ruby on Rails will help you knock out that killer idea list you’ve been sitting on for months.

5. Eliminate Lame Tasks

Rails is built on Ruby, the dynamic and object-oriented language. This means that you can better use your time. For instance, RoR will handle all database communications, provide a template system for handling page sections and layouts, process Ajax updates and a wide set of plugins that make feature implementing easy. In other words, RoR takes care of the boring stuff while you can focus on the cool.

6. Building a Complex Website

Building a website is probably the most common scenario in which you would use RoR. However, you could also use PHP. Why use one over the other? The argument goes like this: if you are just adding simple functionality to a basic, straightforward website, then use PHP. On the other hand, if you are building a complex website or app that involves a database then you’ll want to use Rails.

7. Plan on Building More Websites in the Future

Learning a new language and tool takes time and effort. So if you think that you might be able to use Ruby on a single project—and don’t think you will have to use it again—it’s probably not worth the effort.

However, if you plan on continuing to build complex websites and applications then the investment in learning Ruby on Rails is probably worth it.

8. Serve a Particular Market

Some developers like to work in a particular market. So they build a set of specialized skills that suits that market. This will lead them to usually being hired by designers who don’t have expertise in a set of skills like RoR. This means you won’t be working for clients. You will be hired for your particular skill set by an agency.
The other scenario is that you work directly for the client. They don’t care whether you use PHP or Ruby. They just want you to build them a website that will do X, Y and Z. It’s your job to figure out how to effectively do that, so knowing both PHP and Ruby is a must.

9. Join a Great Community

Even though RoR is a relatively new framework, it has certainly built up a robust community full of nice people who want to help you learn. These communities are where best practices are shared, reinforced and even questioned. You will feel comfortable asking just about any question.

railscommunity 20 Reasons Why Every Web Designer Needs to Learn Rails

The Rails Community is one of the main reasons to learn Rails.

10. Collaborate with Other Developers

Just like web designers have universal standards they have to obey, reliable Photoshop workflows and proven CSS tricks, the same is true for Ruby on Rails. The way apps are built are getting more uniform as the Ruby community continues to grow, so working and collaborating with other developers is way easier than it was before.

11. Learn to Code

Maybe you don’t know how to code at all. You could be a writer who is bored (see no. 3) and wants a hobby. Or you could be an entrepreneur who’s got an idea for a new web app and you want to see if the thing has any legs to run on.

Thus, you want to learn how to code.

Now, you don’t need any programming experience to learn Ruby. However, much of what you learn about Ruby will be lost on you if you don’t. It’s sort of like knowing the answer to an arithmetic problem—but not knowing how you got the answer.

12. Become a Better Coder

More than likely, though, you are a coder. A good one. But you want to become better. Well, learning Ruby is one way you can do that.

However…

People can argue until their faces are blue about which skill sets are the best: PHP, Java, Python or Ruby. But at the end of the day I think they would all agree that what really counts when it comes to being a better coder is to have an understanding of multiple server-side languages, whether it is Python, Java, Ruby or all of the above. The more the merry because doors will open for you where they might be otherwise shut.

13. You Already Know PHP

I know some passionate RoRs who will say hands down that you do not want to learn RoR until you’ve got a handle on PHP. This doesn’t mean you have to master PHP. All you need is just a basic understanding of how to get a few things done in PHP.

But if you already know PHP, then the transition to using RoR is seamless. See, the nice thing about RoR is that you don’t have to code from scratch every time you need something done. That’s what an effective framework does. But it still helps if you know what’s going on at a lower level. So, if you are a PHP pro, then I recommend you jump on RoR right away. You’ll learn it pretty quickly.

14. Express Your Ideas through a Computer

Famed Ruby evangelist _Why wrote in his book _Why’s Poignant Guide to Ruby, “I’ve noticed that many experienced users of Ruby seem to be clear thinkers and objective. In contrast to: heavily biased and coarse.”

Like many programming languages, Ruby will teach you how to express your ideas and stories through a computer. The language is like a tool that allows you to link your mind to the real world. In fact, you may discover that Ruby is a fantastic language that lines up with your own mental model of the world. In other words, if you struggle getting your thoughts out of your head, then Ruby just might be the right tool for you.

15. Build Your Personal Brand

There’s a reasons there is a demand for Ruby on Rails developers: it’s the fastest and most efficient way to build apps for the web. And big brands to brand-new startups are tapping RoR developers to get that speed and agility.

And get this: that demand is likely to continue. So learning to build sites with Rails is a valuable step in your web development career.

16. Won’t Be Using WordPress and Co.

PHP is the programming language for Drupal, Joomla, Magento and WordPress. So if you want to develop for those, you will need PHP. Not Ruby.

However, some suggest their future is uncertain. So, if you are in it for the long haul and want to progress with the web, go with a more progressive skill set like RoR. Again, it is probably help for you to learn PHP first if you don’t know that language already.

17. Stay Current with Web Changes

I think it’s become clear by its popularity that Ruby is where the web is headed. Scratch that. Ruby is where the web is now. And that demand is only going to continue.

There are so many things that make Ruby popular. Console tools like irb allow you to test any code at any time—before adding it to a file. Huge in terms of efficiency and accuracy, as is the fact that you can unit test, which provides huge productivity boosts. Just like PHP had its heyday, RoR is having it’s now.

18. Re-Use Software Down the Road

One of the stellar beauties of RoR is that you can use and re-use software for different projects. This is what RoR creator David Heinemeier Hansson (37signals) had in mind as he built their flagship product Basecamp.

During the development he took the apps underpinnings and created building blocks for future use. He made the framework extensible, expandable, and multi-purpose. Think plug-and-play.

He then shared the software with the open source market where the framework was improved and extended. Nearly ten years later it is now a solid and reliable software development platform that’s powering some of the most popular and powerful sites out there.

19. You Know Ruby (the Language)

Learning Ruby (the language) before Rails (the framework) is a wise move because it helps the developer to understand what is going on under the hood. Sure, the framework can do all the heavy lifting when it comes to building a web app, but it helps to understand how and why.

20. Learn the Better Language

That’s a loaded statement, so let me explain. As I mentioned above, there really is no “better language.” What there is are advantages and disadvantages.

For example, Ruby is a lot easier to read. One familiar comparison I’ve heard thrown around a lot is that Vanilla JavaScript is to jQuery what PHP is to Ruby. Ruby, like jQuery, is concise and logical. They both make sense and are easy to learn.

PHP, like Vanilla JavaScript, is a little long-winded and complex enough to cause your brain to hurt when you are trying to learn them. But PHP is way easier to learn than Vanilla Javascript, and Ruby is even easier still.

Conclusion

No doubt learning a major new skill set is no easy task. It takes time and sweat and discipline. You can’t take such an effort lightly. But if you do decide to take the plunge it will be worth it.

Not only can RoR provide you with a vast array of benefits like cutting through the headaches of web application development, but, more importantly, it can help you become that software developer that everybody wants. And who doesn’t want that?

How to Install Ruby on Rails on CentOS 6

About Ruby on Rails


Ruby on Rails is an application stack that provides web developers with a framework to quickly create a variety of web applications.

There are three separate processes required to install Ruby on Rails: you need to install Ruby, then the Ruby Gems, then Rails.

Set Up


The steps in this tutorial require the user to have root privileges. You can see how to set that up in the Initial Server Setup Tutorial in steps 3 and 4.

Step One—Install Ruby


The easiest way to install Ruby on your virtual server is through the yum package installer.

sudo yum install ruby

After you say yes to the prompt, Ruby will install.

Then we need some additional Ruby dependancies.

Type the following into terminal:

sudo yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel
sudo yum install ruby-rdoc ruby-devel

While it processes, the prompt may ask your permission to install the various packages. Go ahead and say yes each time.

Step Two—Install Ruby Gems


Once you have Ruby installed, you can easily install the ruby gems.

Type this command into terminal:

sudo yum install rubygems

After you have agreed to the prompt, ruby gems should be installed on your VPS. However, if you have any issues with this process, you can use an alternate method to install the Ruby Gems.

How to Install RubyGems from Source


If, for some reason, the yum installer doesn’t work for you, you can follow these steps to install ruby gems from the source.

To start, we will create a new directory to store the ruby code.

sudo mkdir ~/src
sudo cd ~/src

Then we can go ahead and download the ruby gems into the new folder. (You can always access the latest available gems by visiting: http://rubygems.org/pages/download)

wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz?tar -zxvf rubygems-1.3.6.tgz
cd rubygems-1.3.6

Finally you are ready to install the ruby gems.

sudo ruby setup.rb

After you answer yes to the prompt, the gems will finish installing.

You will now be ready to install Rails on your virtual server.

Step Three—Install Rails


We should quickly do two updates to makes sure that everything is up-to date and set up correctly:

Check the gems:

sudo gem update

Then check the system overall:

sudo gem update --system

Once everything has processed, it is time to install Rails.

To start, open terminal and type in:

sudo gem install rails

This process may take a while, be patient with it.

If you are feeling especially antsy, you can type in:

sudo gem install rails -V

Terminal will then show you all the details of the process, so you can see that it is working.

After you answer yes to the prompt that comes up, rails will finish installing.

You have successfully installed Ruby on Rails!

Here’s Why Ruby On Rails Is Hot

Many companies have asked the questions “What’s the fastest way to develop my web apps?” and “Should I use Java, Ruby, Python or something else?”

These companies range from start-ups to established enterprises, and many have come to the conclusion that when creating apps that are designed to be delivered on the web, Ruby on Rails is the best choice.

Ruby on Rails is an open-source web application framework for the Ruby programming language. The growing demand for Ruby on Rails has been driven by successful companies who benefit from the speed and agility of building applications in Rails, which results in increased productivity and company growth. Many of the companies you all know and love use Ruby in some capacity: Amazon, BBC, Cisco, CNET, IBM, JP Morgan, NASA, and Yahoo!. Many of the fastest-growing web-based companies have been built using Ruby on Rails: Scribd (over 70 million readers each month), Groupon (over 38.5 million subscribers in North America), Basecamp (millions of users). All in all, more than 200,000 web sites are using Ruby on Rails.

Why Ruby on Rails is Hot
I believe that Ruby on Rails is on fire because it is the most productive way to build web applications. This is a conclusion that I’ve drawn first hand by building Rails applications for customers for nearly five years.

Custom software development has always been expensive, which has resulted in shrink-wrapped solutions dominating the software market. But how can businesses differentiate themselves from each other if they all use the same applications? Custom software can help businesses differentiate themselves and provide deep competitive advantage through data collection, visualization, and distribution at the edges of an organization, where users and departments know what data they need to operate efficiently. Ruby on Rails makes this type of software development economical for companies ranging from high-growth start-ups to large corporations wanting to experiment without risking additional IT budget.

In the past, when users in a company pined for a new application to take advantage of market opportunities and trends, they had to first present a formal request to their boss. This turned into a formal request to the IT department, which was then reviewed by a board for budget approval. Once the budget was approved, equipment and personnel skills had to be evaluated. Six months later, the project might begin. Individual groups within companies are now learning to use Rails to speed up development and reduce costs.

The Criticisms
Even with the high growth rates, Ruby on Rails still faces criticism. Some claim that Ruby on Rails is less efficient than other languages. Some will simply assert “Ruby isn’t Java — end of argument” as if Java’s dominance in software development is eternal, unassailable, and even desirable.

The efficiency argument is not economically sound. The vast majority of application business costs are development, sales, and marketing. The cost of compute cycles as a share of overall application expenses is minute and shrinking fast. For the cases where compute cost is a major concern, Ruby is becoming more efficient through its latest implementations: JRuby, Rubinius, and Ruby 1.9. It’s important to remember that Java was also written off in its early days because it was “inefficient.” Yet, the market saw that its productivity benefits relative to incumbent technologies outweighed that disadvantage, and its “inefficiency” all but disappeared as a downside of Java. We are seeing the same evolution with Ruby.

Ruby is inherently different from Java. The argument commonly made is that Java is an enterprise-grade language while Ruby is used for geeky-cool apps in social, mobile, and e-commerce that are designed to attract a big consumer base. The fact that Ruby applications are built to web-scale and serve hundreds of millions of users versus enterprise-scale apps which serve mere hundreds of thousands of users (at the high end) should settle the question of whether Ruby on Rails can handle enterprise loads. Throw in the fact that Ruby on Rails allows internal development groups to be more productive and accelerate their development projects, you can see the benefits of building new apps in Rails rather than Java.

According to Eric Knipp, Research Director at Gartner: “Many high-profile consumer Web firms are choosing Ruby on Rails to rapidly build scalable web applications. Ruby on Rails has the potential to emerge as a strong alternative platform to traditional choices based on Java and .NET for next-generation enterprise applications, as companies seek improved agility, development speed and time to market.”

Using Ruby on Rails for Success
With start-ups increasingly focused on information delivery rather than physical product delivery, many choose Rails to build apps quickly, at low cost and, therefore, low risk. They are leveraging Ruby on Rails’ software delivery economics in the core of their products and services.

Groupon is known as a remarkable example of a successful, scalable app built on open source technologies (including Ruby on Rails). Groupon features a daily deal on the best things to do, see, eat, and buy in more than 500 markets and 44 countries. With over 38.5 million subscribers in North America, Groupon’s daily deal has become immensely popular. The technical requirements to build and maintain a website with these kinds of daily traffic bursts are substantial, and Ruby on Rails is a key part of this web application.

Luckie & Co. used Ruby on Rails to build the Bayer Advanced website. Bill Abel, Vice President and Director of Digital Development at Luckie & Co. outlines the tremendous benefits of developing in Rails: “We chose Ruby on Rails because it allows us to develop websites dramatically faster. We finished the first release of the Bayer Advanced website in 2 months – a 50% reduction in development time. Rails is a complete 180 to traditional app development; it’s very structured and the built-in hooks made our transition much easier. The Rails test-driven development model has helped us achieve development efficiencies, so we can build websites more quickly and deliver a much more reliable product.”

More than 48,000 companies use Get Satisfaction to build their online communities. Thor Muller, CTO and co-founder of Get Satisfaction describes why they chose Ruby on Rails to build their customer service platform: “Ruby on Rails offers more than just pure speed. We know it’s faster to develop an initial working product in Rails, so prototyping in Rails made a lot of sense for us. As we worked more with Rails, we realized it was also ideal for our work style and the types of personalities we wanted developing our product — particularly because our established developers like the elegance of the Ruby language and Rails framework.”

With Ruby on Rails providing a programming framework that includes reusable, easily configurable components commonly used for creating web-based applications, it is gaining traction with developers.

The Developers
What can the developer world take away from the fast growth of Rails? Doing a quick check on indeed.com for job growth trends, Ruby on Rails developers are a very hot commodity. With major players such as VMware, Salesforce.com, and HP making important industry moves highlighting Ruby as the language of the cloud, the job market will continue to show high demand for Rails developers. In fact, it’s nearly impossible to be an unemployed Ruby on Rails developer.

The Future
As businesses explore how they can use Ruby on Rails to build their next-generation products and services for consumers and employees, they’ll discover the significant development time savings Ruby on Rails offers. Coupling this with low up-front investment and overall cost savings, it makes perfect sense that we’ll continue to see more companies choosing Ruby on Rails. Try it out–work with your team on a small project and see how it speeds development time, increases developer productivity, and results in highly scalable web apps.