Monday, 21 April 2014

RAILS3 APPLICATION DEVELOPMENT STEPS


RAILS3 APPLICATION DEVELOPMENT STEPS


Step1: choose your rvm version and related gemset by issue below command.
$rvm use [rvmname]@[gemsetname]
ex: $rvm use 1.9.3@fb
then, your application going to use ruby 1.9.3 with gemset fb

Step 2: create a new application.
$rails new [appln name]
ex:$rails new myapp


Step3: uncomment line  NO 18 in myapp/Gemfile (gem 'therubyracer', :platforms => :ruby)

Step4: install the bundle

$bundle install

it will install all the gems specified in the gemfile.

Step5:run the server
$rails s (run with default port number 3000)
(or)
$rails s -p [portnumber]
Ex: $rails s -p 4000 (run with port 4000 )
 
Step 6: go to browser try to open localhost:3000

it will show fallowing output:
 
Step 7: Remove  myapp/public/index.html.erb page.
Step 8: create your own models/controllers using below commands.
  • To generate models,controller and views.
        $rails g scaffold [modelname singulur]
  • To generate only controller.
        $rails g controller [contollername] 
  • to generate only model. 
        $rails g model [modelname]
Ex: $rails g scaffold home
Step 8: add below line to myapp/config/routes.rb file.
$root :to => 'home#index'
Step 10: run your application on browser myapp/views/home/index is your home page.

Happy Reading...........:-)







No comments:

Post a Comment