Showing posts from 2011

Basics of Include and Extend in Ruby on Rails

Include is for adding methods to an instance of a class and extend is for adding class methods. Let’s take a look at a small example.

module Foo def foo puts 'heyyyyoooo!' end end class Bar include Foo end # heyyyyoooo! # NoMethodError: undefined method ‘foo’ for Bar:Class class Baz extend Foo end # heyyyyoooo! # NoMethodError: undefined method ‘foo’ for #As you can see, include makes the foo method available to an instance of a class and extend makes the foo method available to the class itself.

Class and Instance Methods in Ruby

Class methods are methods that are called on a class and instance methods are methods that are called on an instance of a class. Here is a quick example and then we’ll go into a bit more detail.

class Foo def puts 'class method' end def baz puts 'instance method' end end # => "class method" Foo.baz # => NoMethodError: undefined method ‘baz’ for Foo:Class # => instance method # => NoMethodError: undefined method ‘bar’ for #Class Methods

Ruby is very flexible and as such it allows several ways to define a class method. The following is a sample of the most commonly used ways.

# Way 1 class Foo def puts 'class method' end end # "class method" # Way 2 class Foo class << self def bar puts 'class method' end end end # "class method" # Way 3 class Foo; end def puts 'class method'…

Play with Rails Console

app is another local variable which is avaliable to you,  It’s a local variable you get for free in script/console. An instance of


$ rubyscript/consoleLoadingdevelopmentenvironment.>>app.url_for(:controller=>'stories',:action=>'show',:id=>'10002')=>"">>app.get'/stories/10002'=>200>>app.assigns(:story)=>#<Story:0x24aad0c ... >>>app.path=>"/stories/10002">>app.reset!=>nil>>app.get'/yeah/right/dude'=>404>>'/account/login',{:username=>'username',:password=>'password'}=>200>>app.cookies=>{"_session_id"=>"9d1c014f42881524ff6cb81fb5b594bc"}

Helpers in Rails Console

Rails gives you a helper local variable to play with.

$ rubyscript/consoleLoadingdevelopmentenvironment.>>helper.pluralize2,"story"=>"2 stories">>helper.submit_tag=>"<input name=\"commit\" type=\"submit\" value=\"Save changes\" />">>helper.visual_effect:blindUp,'post'=>"new Effect.BlindUp(\"post\",{});"

Rails Array Methods

to_sentence (Array)
>> %w[Chris Mark Steven].to_sentence => "Chris, Mark, and Steven"  You can pass it two options: :connector and skip_last_comma. They work like a’this:

>> %w[Soap Mocha Chocolate].to_sentence(:connector => '&') => "Soap, Mocha, & Chocolate" >> %w[Ratatat Interpol Beirut].to_sentence(:skip_last_comma => true) => "Ratatat, Interpol and Beirut" to_param (Array)

>> helper.url_for :controller => 'users', :action => 'show', :id => %w[one two three] => "/users/one%2Ftwo%2Fthree"
in_groups_of (Array)

>> %w[1 2 3 4 5 6 7].in_groups_of(3) { |g| p g } ["1", "2", "3"] ["4", "5", "6"] ["7", nil, nil] >> %w[1 2 3].in_groups_of(2, ' ') { |g| p g } ["1", "2"] ["3", " "] >> %w[1 2 3].in_groups_of(2, false) { |g| p g } ["1&q…

Rails String Shortcuts and Methods

at (String)

>> "Finally, something useful!".at(6) => "y" from and to (String)

>>"Chris the Person".from(6)=>"the Person">>"Chris the Person".to(4)=>"Chris"first and last (String)

>>"Christmas Time".first=>"C">>"Christmas Time".first(5)=>"Chris">>"Christmas Time".last=>"e">>"Christmas Time".last(4)=>"Time"each_char (String)


starts_with? and ends_with? (String)

>>"Peanut Butter".starts_with?'Peanut'=>true>>"Peanut Butter".ends_with?'Nutter'=>false
to_time and to_date (String)

>>"1985-03-13".to_time=>WedMar1300:00:00UTC1985>>"1985-03-13".to_date=>#<Date: 4892275/2,0,2299161>
transformations! (String)


A Complete Rails Cheat Sheet in your Console

A Complete Rails Cheat Sheet in your Console

A Complete help no need to search any where else just few steps

First you need to install cheat gem

sudo gem install cheat
Then try using cheat commands like

cheat svn
and this will show, you can try git, strftime and my favorite  migrations !! enjoy !!
nishant@ubuntu:~/home/Application$ cheat svn svn: Creating a new repository: mkdir /path/to/new/dir svnadmin create /path/to/new/dir Starting svnserve: svnserve --daemon --root /path/to/new/repository Importing project into svn repo: $ svn import -m "Wibble initial import" svn://olio/wibble/trunk Creating directory in svn repo: $ svn mkdir -m "Create tags directory" svn://olio/wibble/tags Branching: $ svn copy \ \ -m "Creating a private branch of /calc/trunk." Committed revision 341. Diff / Merge: …

Secrets of Rails Console and Tricks

Reloading the console When you make some changes your models and need to see those changes reflected in your Rails application in a web browser you just hit Reload Or refresh the whole page. In development  mode, the Rails application loads all the files anew every single time a page is requested. The same is true for the console—but it loads the files anew every time you start the console, instead of per page request.

To avoid having to quit and reopen the console every time you change your application’s code, simply type the follow command:

>> Dispatcher.reset_application! Or, better yet:

>> reload! This is what you’ll see:

>> reload! Reloading...Rollback all database changes on exit How to run the console in a sandbox—meaning that all your database changes are completely reverted when you exit the console.
Basically, it looks like this:

$ script/console --sandbox
Loading development environment in sandbox. Any modifications you make will be rolled back on exit.

Apache Solr Installation on linux : Complete Setup

Installing Tomcat 6 in Ubuntu 10.04 and Libmysql-java:

$ sudo apt-get update && apt-get upgrade
$ sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples

$ sudo apt-get install libmysql-java

Download apache-solr-1.4.1.tgz from and extract it:

$ cd
$ sudo cp apache-solr-1.4.1/dist/apache-solr-1.4.1.war /usr/share/tomcat6/webapps/solr.war
$ sudo cp -R apache-solr-1.4.1/example/solr/ /usr/share/tomcat6/solr/

note : we copy solr folder into /usr/share/tomcat6 and it will pointed as solr home in next step.

Create new Solr configuration in Tomcat6:

$ sudo vim /etc/tomcat6/Catalina/localhost/solr.xml

Paste this into file :

Enable MultipleCore in Solr 1.4.1:

$ sudo cp apache-solr-1.4.1/example/multicore/solr.xml /usr/share/tomcat6/solr/solr.xml
$ sudo cp -R apache-solr-1.4.1/example/multicore/core0 /usr/share/tomcat6/solr/
$ sudo cp -R apache-solr-1.4.1/example/multicore/core1 /usr/share/tomcat6/solr/
$ sudo mkd…

Apache Solr Installation : Steps

sudo apt-get update && apt-get upgrade

sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples

sudo apt-get install libmysql-java


sudo tar -zxvf apache-solr-1.4.1.tgz

sudo cp apache-solr-1.4.1/dist/apache-solr-1.4.1.war /usr/share/tomcat6/webapps/solr.war

sudo cp -R apache-solr-1.4.1/example/solr/ /usr/share/tomcat6/solr/

sudo nano /etc/tomcat6/Catalina/localhost/solr.xml

(and paste the code :- <Context docBase="/usr/share/tomcat6/webapps/solr.war" debug="0" privileged="true" allowLinking="true" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/usr/share/tomcat6/solr" override="true" />

sudo cp apache-solr-1.4.1/example/multicore/solr.xml /usr/share/tomcat6/solr/solr.xml

sudo cp -R apache-solr-1.4.1/example/multicore/core0 /usr/share/…

Make Dynamic Paths for Paperclip in Ruby on Rails application

For creating Dynamic paths , we need to overwrite the Paperclip::Interpolations module of paperclip and we will add a new method like user_id etc and this will return that dynamic value which will be used to create a dynamic path.


module Paperclip module Interpolations def user_id attachment, style_name attachment.instance.user_id end end end And now we can use :user_id in our path 
has_attached_file :user_image :url => "../assets/users/:user_id/#{}_:basename_:id" + ".:extension", :path => ":rails_root/public/assets/users/:user_id/#{}_:basename_:id" + ".:extension"

ImageMagick Installation with PNGlib and JPEGlib

Unpack the distribution with this command:

tar xvfz ImageMagick.tar.gz

Next configure and compile ImageMagick:

cd ImageMagick-6.7.4

With every installtion there is a read me file like install-unix.txt , from there you will find the options to add additional libraries like png and jpeg , so you need to make change in configure command with those options.

./configure --with-jpeg=yes --with-png=yes --with-tiff=yes --with-freetype=yes  --with-fontconfig=yes --with-modules=yes --enable-shared=yes


If ImageMagick configured and compiled without complaint, you are ready to install it on your system. Administrator privileges are required to install. To install, type

sudo make install

You may need to configure the dynamic linker run-time bindings:

sudo ldconfig /usr/local/lib

Finally, verify the ImageMagick install worked properly, type

/usr/local/bin/convert logo: logo.gif

Renaming Application on Heroku along with Url

First you need to login to Heroku from command line using this command

$ heroku login  Please follow this link Heroku : Complete Setup

Then, You can rename an app at any time with the heroku rename command. For example, to rename an app named “oldname” to “newname”, change into the app’s git checkout and run:

$ heroku rename newname | Git remote heroku updated Renaming an app will cause it to immediately become available at the new subdomain ( and unavailable at the old name (

This may not matter if you’re using a custom domain name, but be aware that any external links will need to be updated.

Heroku Application with Custom name and Url

If you would like to create a New Application with your own name for free on Heroku Please follow this link Heroku : Complete Setup

If you wanted to create a new application with your custom name , First you need to login to Heroku from command line using this command

$ heroku login
After that you need to enter your credentials email address and password. Once you logged in you need to run this command

$ heroku create myappCreated | Git remote heroku added Using this command you can create a new application with custom name and url

Creating an App Without a Name

The app name argument (“myapp”) is optional. If no app name is specified, a random name will be generated.

$ heroku create Created |

Interview Question on Ruby on Rails

1.  Why Ruby on Rails?

Ans: There are lot of advantages of using ruby on rails DRY PrincipalConvention over ConfigurationGems and PluginsScaffoldingPure OOP ConceptRest SupportRack supportAction MailerRpc supportRexml Support
2. Explain about the programming language ruby?

Ruby is the brain child of a Japanese programmer Matz. He created Ruby. It is a cross platform object oriented language. It helps you in knowing what your code does in your application. With legacy code it gives you the power of administration and organization tasks. Being open source, it did go into great lengths of development.

3. Explain about ruby names?

Classes, variables, methods, constants and modules can be referred by ruby names. When you want to distinguish between various names you can specify that by the first character of the name. Some of the names are used as reserve words which should not be used for any other purpose. A name can be lowercase letter, upper case letter, number, or an underscore, make su…

3 Ruby Tools For Newbies

If you're new to programming in Ruby, here are the 3 tools you must know.

The Ruby debugging tool can be found in the library file debug.rb. This tool will let you run your program one instruction at a time, with pauses in between. At every pause you can examine the values or variables of your code, locate your position in a series of nested commands and/or resume execution. You can also tell the debugger when to stop, more commonly known as breakpoints.

Using a debugger varies from programmer to programmer. Just because a debugging facility is available for Ruby, it doesn't mean that a novice programmer should quickly adapt himself to using it at once. There are programmers who are comfortable using a debugger, some aren't. It's a matter of preference but at any rate, it's nice to know that there's a tool available for Ruby.

Eventually, when you start writing longer programs, you'll want to measure how much resources, especi…

Discover the 5 Reasons to Adopt Ruby on Rails

A productive framework has changed the rules of web development.
Ruby on Rails is a framework innovation: it contains all the ingredients necessary to quickly build a web application performance. It is a tool designed in the spirit of agile development to deliver productivity and flexibility for development teams.

Based on the Ruby development language, it has revolutionized the world of web development through its pragmatic approach.

Ruby on Rails' philosophy is summarized by two principles:

• "Never again" and it saves time, concentration and reduces code size.
• "Convention over configuration": it is better to use the conventions that wasting time to configure.

The advantages of Ruby on Rails:

1 - Develop faster
Ruby on Rails is a compact language provided a clear and concise syntax: it produces less code than its competitors.Less code to produce, so it's less time to code, less error-prone, less code to maintain.Integrated tools for automating r…

Basic Facts About Ruby on Rails Programming Language

The saying "Feels lighter, more agile, and easier to understand" has become the definition for ruby on rails. Many people still don't know that ror is otherwise called as ruby on rails. Let's learn more about the basic facts of ruby on rails, the lightening fast programming language today.

David Heinemeier Hansson has created ruby on rails during 2003. Today there are around 1500 contributors in the rails core team who has been extending wonderful features in rails.

Ruby on rails helps to develop a website much faster in a simple way. ROR is an interesting framework that has been implemented in almost all web solutions.
Famous websites such as BaseCamp, CrunchBase, Github, Hulu, Penny Arcade, Scribd, Spiceworks, Twitter, Urban Dictionary, XING and are using ruby on rails.

Some of the merits of ruby on rails include:
1. web applications can be performed in a matter of days.
2. dynamic, imperative and reflective
3. object-oriented prog…

5 Useful Tips for Ruby on Rails Developers

Ruby on Rails is an open source web application framework for the Ruby programming language. It is specially designed to be used by the web developers for rapid development. Like many web frameworks, Ruby on Rails uses the Model-View-Controller architecture pattern to organize application programming.

It includes tools that make common development tasks easier. If you follow the correct conventions, you will be able to avoid lengthy configuration of files and you can have more time to focus on business logic.

If you are a developer, here are some useful points I would like to share with you. These points will help to make your jobs easier.

Rails has a well-defined plug-in structure that allows the users to install and use plug-ins in the application easily. David Heinemeier Hansson, the founder of Rails stated that he used 5-6 plug-ins in each Rails application. Being the developer, you don't need to waste your time writing the program. You just need to make use o…

Caching Techniques that Rails provides by Default

This is an introduction to the three types of caching techniques that Rails provides by default without the use of any third party plug-ins.

Page Caching Action CachingFragment CachingPage caching is a Rails mechanism which allows the request for a generated page to be fulfilled by the web-server (i.e. Apache or nginx), without ever having to go through the Rails stack at all.

Page caching is an efficient way to cache stateless content.

Obviously, this is super-fast. Unfortunately, it can’t be applied to every situation (such as pages that need authentication) and since the webserver is literally just serving a file from the filesystem, cache expiration is an issue that needs to be dealt with.

class ProductsController < ActionController caches_page :index def index @products = Products.all end def create expire_page :action => :index end end One of the issues with Page Caching is that you cannot use it for pages that require to restrict access som…

Create New Rails Application with MongoDB

Create a New Rails Application with MongoDB
# Use sudo if your setup requires it gem install rails Create New Rails Application by skipping the Active Record
rails new awesome_app --skip-active-record This is the gem file and the list of the required gems for MongoDB

require 'rubygems' require 'mongo' source :rubygems gem 'mongo_mapper' gem 'rails', '3.0.3' gem 'devise', '1.1.3' gem 'devise-mongo_mapper', :git => 'git://' group :test, :development do [whatever testing gems you want in here] end Then Run bundle install to install all the gems mentioned in the gem file.
$ bundle install There's two initializer files we'll need. We add the one for mongo,  which I put in config/initializers/mongo.rb:
# config/initializers/mongodb.rb include MongoMapper db_config = YAML::load(, "/config/mongodb.yml"))) if db_con…

Capistrano Setup and Deploy file options

You will need to install the Capistrano gem and its dependencies sudo gem install capistrano  Always keep in mind that Capistrano runs on your local machine. It uses Net::SSH and Net::SFTP to connect to your remote servers and run shell commands on them. This means you do not need to install Capistrano on your remote servers, only on the machines you want to use to trigger a deploy.

Capistrano uses a Rake-like syntax for defining tasks that will execute on the server. Each task has a name, followed by a code block.

Every time you deploy, Capistrano creates a new folder named with the
current date and then checks out your entire Rails app into that folder.
Next, it wires the whole thing together with several symbolic links

Notice the current directory doesn’t have the physical file structure underneath it. current directory is only a link into a specific dated folder in the releases directory. The result is that current will always hold the current active version of your application. F…

Capistrano : A Brief Introduction

Capistrano is a Ruby gem designed to execute tasks on one or more remote machines. You’ll need SSH access to use Capistrano. Capistrano, affectionately known as Cap, automates the deploy process. We can use cap to take our code from some a repo and push it to the server, stop/start/restart the server, write custom tasks required by our application (think install required gems), or disable/enable a maintenance page. Using cap is not required but it sure beats using FTP to copy all the files around! Cap’s real power comes from the ability to write custom tasks in Ruby to manipulate the server.

We’ve written a lot of applications that allow user file uploads. Then on the server side, some directory needs to be created with proper permissions for the uploads to succeed. It’s easy enough to write a cap task to create the directory and set the permissions. Then, if you ever change servers, you can simply run the cap task to setup the server again. There are many things you can do with Capis…

Fixing readline for the Ruby on Rails console

Fixing readline for the Ruby on Rails console
$ rails console /home/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError) from /home/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/completion.rb:9:in `' from /home/user/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands/console.rb:3:in `require' from /home/user/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands/console.rb:3:in `' from /home/user/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:20:in `require' from /home/user/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:20:in `' from script/rails:6:in `require' from script/rails:6:in `' The problem is that Ruby is somehow not cofigured to load the readline library and thus cannot run its console. This is a downside of using a language specific package manager, seperate from your …

MongoDB : An Introduction

MongoDB is an open-source, high-performance, document-oriented database. Documents are JSON-like data structures stored in a format called BSON (

Documents are stored in Collections, each of which resides in its own Database. Collections can be thought of as the equivalent of a table in an RDBMS. There are no fixed schemas in MongoDB, so documents with different “shapes” can be stored in the same Collection.

MongoDB features full index support (including secondary and compound indexes); indexes are specified per-Collection. There is a rich, document-based query language (see reverse) that leverages any indexes you've defined. MongoDB also provides complex atomic update modifiers (see reverse) to keep code contention-free.

Clustered setups are supported, including easy replication for scaling reads and providing high availability, as well as auto-sharding for write-scaling and large data-set sizes.

MongoDB : Setup

First Download the mongodb  using these commands

$ curl > mongo.tgz $ tar xzf mongo.tgz By default MongoDB will store data in /data/db, but it won't automatically create that directory. To create it, do:

$ sudo mkdir -p /data/db/ $ sudo chown `id -u` /data/db You can also tell MongoDB to use a different data directory, with the --dbpath option. First, start the MongoDB server in one terminal:

./mongodb-xxxxxxx/bin/mongod To install MongoDB shell.

sudo apt-get install mongodb

Heroku : Complete Setup

Heroku Setup For your Rails applicationCreate Heroku Account

Then you need to install Heroku Gem in your application , if you are using RVM then you need to run

gem install heroku
Or you can use bundler to install heroku by mentioning that in the Gemfile

gem 'heroku'
Then you need to add your Public key to the Heroku Account.

ssh-keygen -t rsa -f ~/.ssh/your_name -C ""
You can use this command to create a new pair of public and private keys and you can give keys a unique name , if you are already using a keys and wanted to create a new one.

After that you need to login to heroku from your terminal by using

heroku login
After that you need to enter your email address and password which you have created for your heroku account.

Once you logged in to your Heroku Account from your terminal , you need to add the key which you have created to that account , you can do this by

heroku keys:add /path_to/.ssh/
Once you did that , you can ta…

Rails Architecture : Model , Views and Controllers

In a Rails application, incoming requests are first sent to a router, which works out where in the application the request should be sent and how the request itself should be parsed. Ultimately, this phase identifies a particular method (called an action in Rails parlance) somewhere in the controller code. The action might look at data in the request itself, it might interact with the model, and it might cause other actions to be invoked. Eventually the action prepares information for the view, which renders something to the user.

The model is responsible for maintaining the state of the application. Sometimes this state is transient, lasting for just a couple of interactions with the user. Sometimes the state is permanent and will be stored outside the application, often in a database.

A model is more than just data; it enforces all the business rules that apply to that data. For example, if a discount shouldn’t be applied to orders of less than $20, the model will enforce…

Different types of joins in SQL

Inner Join - Inner join creates a new result table by combining column values of two tables (A and B) based upon the join-predicate. The query compares each row of A with each row of B to find all pairs of rows which satisfy the join-predicate. When the join-predicate is satisfied, column values for each matched pair of rows of A and B are combined into a result row. The result of the join can be defined as the outcome of first taking the Cartesian product (or Cross join) of all records in the tables (combining every record in table A with every record in table B)—then return all records which satisfy the join predicate

Inner joins is further classified as equi-joins, as natural joins, or as cross-joins.

An equi-join, also known as an equijoin, is a specific type of comparator-based join, or theta join, that uses only equality comparisons in the join-predicate. Using other comparison operators (such as <) disqualifies a join as an equi-join

Natural join

Difference between Validations, Callbacks and Observers

Validations allow you to ensure that only valid data is stored in your database.

validates_presence_of :user_name, :password
validates_numericality_of :value
We can write custom validation also as

def validate   errors.add(:price, “should be a positive value”) if price.nil?|| price < 0.01 end
Callbacks and observers allow you to trigger logic before or after an alteration of an object’s state.

Callbacks are methods that get called at certain moments of an object’s life cycle. With callbacks it’s possible to write code that will run whenever an Active Record object is created, saved, updated, deleted, validated, or loaded from the database.

Callbacks are hooks into the life cycle of an Active Record object that allow you to trigger logic before or after an alteration of the object state. This can be used to make sure that associated and dependent objects are deleted when destroy is called (by overwriting before_destroy) or to massage attributes before the…

Difference between Application server and Web Server

Apache, nginx, IIS are web servers 

Mongrel, Webrick, Phusion passenger are application servers

Application server is something which works with particular programming language and parses and executes the code since mongrel and webrick can only work with rails, so they are app servers

Web servers are servers which can take the request from the browser. Web servers normally works on port 80 though we can change the port in configuration since mongrel and webrick can take that request directly, so they can be thought of as web servers but web servers do have a lot of other functionality like request pipeline, load balancing etc. App servers lack these functionalities. 

About Mongrel server: mongrel work as web as well as app server if you are talking about dev environment but in production, mongrel alone can not work it will be too slow so we need a web server in front of mongrel

Linkedin Gem for Rails application

This is an example to use Linkedin Gem for using linkedin api inside your rails application

If you wanted to replace these things APP_CONFIG['api_key'] with your api keys you can also do that.

These are the things that are fetched by the linkedin gem using the api

first-name last-name headline positions educations skills

You can use @profile to fetch the values and use them according to your requirement. class UserController < ApplicationController def login client =['api_key'], APP_CONFIG['secret_key']) request_token = client.request_token(:oauth_callback => "http://#{request.host_with_port}/user/authenticate_login") session[:rtoken] = request_token.token session[:rsecret] = request_token.secret redirect_to client.request_token.authorize_url end def profile end def authenticate_login client =['api_key'], APP_CONFIG['secret_key'…

Best Way to Define API keys for Rails application

First Create a YML file inside the config folder of the application

your_file_name.yml development: api_key: "your api key" secret_key: "your secret key"

Then create a file in config/initializers folder , for example load_keys.rb and paste the following code inside that
load_keys.rb APP_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/your_file_name.yml")[RAILS_ENV]
Now you can use these inside your application
APP_CONFIG['api_key'] APP_CONFIG['secret_key']

Version Control with Git

Rails developers as practically essential, namely, placing our application source code under version control. Version control systems allow us to track changes to our project’s code, collaborate more easily, and roll back any inadvertent errors (such as accidentally deleting files). Knowing how to use a version control system is a required skill for every software developer.

First-Time System Setup
After installing Git, you should perform a set of one-time setup steps. These are system setups, meaning you only have to do them once per computer:

$ git config --global "Your Name"
$ git config --global

I also like to use co in place of the more verbose checkout command, which we can arrange as follows:

$ git config --global checkout

First-Time Repository Setup
Now we come to some steps that are necessary each time you create a new repository (which only happens once in this book, but is likely to happen again some day). First n…

Ruby on Rails : A Brief Development Overview

Ruby on Rails is the most popular and agile web application development framework written using Ruby programming language. Ruby on Rails often called RoR or Rails is an open source web development framework and an object oriented programming language that helps to develop simple, complete and powerful web applications with rich interactivity along with the latest functionalities.

RoR is developed using the Model-View-Controller Design Pattern and it is favourite among Ruby on Rails developers because of its philosophy of CoC (Convention over Configuration), DRY (Don't Repeat Yourself), and close association with the agile development methodology. The main advantage of using Ruby on Rails is the agile nature of development, what takes months on other platforms, takes only week to develop on Ruby on Rails. Ruby on Rails was first extracted from Basecamp by David Heinemeier Hansson in July 2004 and it is really easy to deploy web solutions using Rails as it works well with a wide …