Most Useful Thing When Creating a New Ruby on Rails Project

27 August 2013

I was thinking what's the most basic and useful tip for using rails on your new project that is often ignored by newbies? - what do you think?

Most useful advice when creating a new Ruby on Rails Project

Using correct version of ruby and rails. Some of the rails features aren't backward compatible meaning not only the new features of Rails are incompatible with older versions of Rails, but some of the old features of rails are incompatible with newer version of Ruby on Rails as well. Confused? I mean Some of the old features may or may not work in the newer version of Ruby on Rails or it will create lots of stupid errors.

So how to solve this problem?
By using the older(correct) version of rails, but how do I use older version of rails if I've already installed the newer version of rails? It's simple. When creating a new project just use following command.

rails _your-suitable-rails-version_ new app_name

for example if you wanna use rails 3.2.8 in your new project the write rails _3.2.8_ new app_name. It's that simple - you're welcome :D

If that gives you any error then run following command:
gem list

It will list all the versions of rails that are installed on your system. Check whether the specified version of rails is installed or not, if not then run following command.

gem install rails --version=Required_version_of_Rails

e.g gem install rails --version=3.2.8

Now run gem list again to confirm that the required version of rails is properly installed or not.

I hope that was useful because that simple thing was creating lots of errors. Let's finish off with a meme :D

Meme on using different version of Ruby on Rails than the one mentioned in the tutorial

I'm new to ruby on rails so feel free to correct me if I'm wrong and remember don't be a jerk.

No comments: