Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my rails command always create a new application?

Forgive me as I'm new to both *nix and ruby on rails. My rails command always creates a new application and I can't figure out why. Running "rails new myApp" will just generate a new rails application named "new" in the current directory. Likewise "rails server" just creates a new application in a folder named "server". Any ideas? I'm using Ubuntu 11.04 and rails 3.0.9.

like image 924
John W Avatar asked Jun 19 '11 06:06

John W


People also ask

How does a Rails application start?

A Rails application is usually started by running bin/rails console or bin/rails server .

What is the command to execute Rails server?

$ rails --help Usage: rails COMMAND [ARGS] The most common rails commands are: generate Generate new code (short-cut alias: "g") console Start the Rails console (short-cut alias: "c") server Start the Rails server (short-cut alias: "s") ... All commands can be run with -h (or --help) for more information.


3 Answers

For creating project in current directory, you can run:

rails new .
like image 88
Viktor Oleksyn Avatar answered Sep 19 '22 19:09

Viktor Oleksyn


You have installed rails through apt-get so you have rails 2. If you want rails 3, use

sudo apt-get remove --purge rails # very important so that the new rails is called
sudo apt-get install rubygems
sudo gem install rails

Don't forget to relaunch your terminal and you're done.

like image 32
Benoît Legat Avatar answered Sep 23 '22 19:09

Benoît Legat


When you create your application with rails new myApp, there should be a myApp/script directory and in there will be a script named rails, this is the rails that understands server and console. So, do this:

$ rails new MyApp
$ cd MyApp
$ script/rails server

To create and start up your application. The naming is a little confusing.

like image 43
mu is too short Avatar answered Sep 21 '22 19:09

mu is too short