Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start rails server?

I am developing rails 2.3.2 application.

When I type the command "rails script/server"

I got the following output instead of server starting why?

rails script/server Usage:   rails new APP_PATH [options]  Options:   -J, [--skip-javascript]        # Skip JavaScript files       [--dev]                    # Setup the application with Gemfile pointing to your Rails checkout       [--edge]                   # Setup the application with Gemfile pointing to Rails repository   -G, [--skip-git]               # Skip Git ignores and keeps   -m, [--template=TEMPLATE]      # Path to an application template (can be a filesystem path or URL)   -b, [--builder=BUILDER]        # Path to a application builder (can be a filesystem path or URL)       [--old-style-hash]         # Force using old style hash (:foo => 'bar') on Ruby >= 1.9       [--skip-gemfile]           # Don't create a Gemfile   -d, [--database=DATABASE]      # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)                                  # Default: sqlite3   -O, [--skip-active-record]     # Skip Active Record files       [--skip-bundle]            # Don't run bundle install   -T, [--skip-test-unit]         # Skip Test::Unit files   -S, [--skip-sprockets]         # Skip Sprockets files   -r, [--ruby=PATH]              # Path to the Ruby binary of your choice                                  # Default: /home/xichen/.rvm/rubies/ruby-1.8.7-p352/bin/ruby   -j, [--javascript=JAVASCRIPT]  # Preconfigure for selected JavaScript library                                  # Default: jquery  Runtime options:   -q, [--quiet]    # Supress status output   -s, [--skip]     # Skip files that already exist   -f, [--force]    # Overwrite files that already exist   -p, [--pretend]  # Run but do not make any changes  Rails options:   -h, [--help]     # Show this help message and quit   -v, [--version]  # Show Rails version number and quit  Description:     The 'rails new' command creates a new Rails application with a default     directory structure and configuration at the path you specify.  Example:     rails new ~/Code/Ruby/weblog      This generates a skeletal Rails installation in ~/Code/Ruby/weblog.     See the README in the newly created application to get going. 

When I type linux command "ls" I got the following directories and files showing:

app  Capfile  config  criptq  db  doc  features  Gemfile  Gemfile.lock  generate  lib  log  nbproject  public  Rakefile  README  script  spec  test  tmp  vendor 

my Gemfile is:

source "http://rubygems.org"  gem "rails", "2.3.2" gem "mysql", "2.8.1" gem "fastercsv" gem "will_paginate", "2.3.16" gem "chronic", "0.6.4" gem "whenever", "0.4.1" gem "searchlogic", "2.4.28"  group :development do   gem "mongrel", "1.1.5" end  group :test do   gem "rspec", "1.3.2"   gem "rspec-rails", "1.3.4"   gem "factory_girl", "1.3.3" end 
like image 870
Leem Avatar asked Sep 23 '11 08:09

Leem


People also ask

What happens when we start Rails server?

One of the things rails server does is that it loads all the dependencies/gems required by your Rails app, or at least sets them up to be auto-loaded later when they are needed. This is sometimes called "booting" or loading the "Rails environment".

Which server is used by Rails?

The Ruby standard library comes with a default web server named WEBrick. As this library is installed on every machine that has Ruby, most frameworks such as Rails and Rack use WEBrick as a default development web server.


2 Answers

In a Rails 2.3 app it is just ./script/server start

like image 171
Volker Pacher Avatar answered Sep 19 '22 00:09

Volker Pacher


For rails 3.2.3 and latest version of rails you can start server by:
First install all gem with command: bundle install or bundle.
Then Configure your database to the database.yml.
Create new database: rake db:create
Then start rails server.
rails server orrails s

like image 43
Ganesh Kunwar Avatar answered Sep 22 '22 00:09

Ganesh Kunwar