Install Rails3 on Ubuntu system with Rails 2.X.X in the system.

I was working on Rails 2.x.x and all I did to catch Rails3 was removed the old Ruby library, uninstalled Rails and gems and installed a latest Ruby library which supports a newer version Ruby on Rails i.e Rails3. The commands I executed to remove the Ruby library were

# sudo gem uninstall rails

This will uninstall the Rails in your Ubuntu system

# sudo apt-get purge ruby rubygems

This will purge the Ruby library and all gems installed in your system.

After uninstalling I installed Ruby-1.9.2 by following commands

# wget

# tar -xvvf ruby-1.9.2-p0.tar.gz

# cd ruby-1.9.2

# ./configure

# make

# sudo make install

It was just installation of this Ruby library, it got me the irb and gem installed in my system since all Ruby libraries with 1.9.X versions has irb and gem inbuilt unlike old Ruby versions where we had to install irb and gem manually.

I installed Rails3 with following command

# sudo gem install rails –version 3.0.0 # sudo bundle install      // This installs all the supportive bundles required.

This got me Rails3 installed in my system, and creation of project and running the application server is little different compared to Rails 2.x.x .

Creating sample application using Rails3 with scaffolding

->     rails new application_name -d mysql ->     rails generate scaffold Post title:string body:text ->     rake db:create   ->     rake db:migrate ->     rails server

I got the welcome page of Rails3 app.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s