Monday, August 22, 2016

Getting started with Ruby on Rails

Hello ...

I found it very easy and awesome framework to work with, till now. I've just started learning ruby on rails, as I love to work with challenging new technologies. let's get started.

It is a such framework that will allow you to work on rapid development, you only need to fire 6 commands on your machine and full scaffolding application is ready with all CRUD operations.

But before that we need to install all the stuffs required to run those commands.

Installations

It's need to be installed the following things before moving forward to application development
  • ruby [apt-get install ruby]
  • gem [apt-get install rubygems]
  • rails [gem install rails]
  • bundle [gem install bundler]
  • rake [apt-get install rake]
** if command doen't work in user scope then try them with 'sudo'


Getting started

Creating an application

Commnad Format: rails new <YOUR_APP_NAME>
Sample Command: rails new demoApp

Move into the created application

Commnad Format: cd <YOUR_APP_NAME>
Sample Command: cd demoApp

Install default dependencies for ROR

Commnad Format: bundle install
Sample Command: bundle install

Create scaffold for particular model

Commnad Format: rails generate scaffold <MODEL> [<ATTR>:<TYPE> [...]]
Sample Command: rails generate scaffold User name:string pass:string

Migrate newly created model, to create db table

Commnad Format: rake db:migrate
Sample Command: rake db:migrate

Start server

Commnad Format: rails server
Sample Command: rails server

Note: default it will start at http://localhost:3000


IF YOU HAVE ANY QUERIES RELATED TO ROR TO GET STARTED
FEEL FREE TO COMMENT BELLOW.