Why does my rails command always create a new application?

跟風遠走 提交于 2020-02-01 00:34:01

问题


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.


回答1:


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.




回答2:


For creating project in current directory, you can run:

rails new .



回答3:


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.




回答4:


That sounds like the behavior of Rails 2, not Rails 3. With Rails 2, typing rails appname would create a new Rails application named appname. With Rails 3, the syntax is now rails new appname. You should double-check that you're using the version of Rails that you think you are. To do that, type rails --version.




回答5:


Rails 2.3.5

rails new       # will create a project new 
rails new myapp # still will create a project new
rails server    # will create a project server

to run the server : cd script ( a directory in your project folder ) and then run ./server




回答6:


The common way to create a Rails application is:

rails new MyApp

This will create a folder with your new Rails application called MyApp

If your folder name is the same name you plan to use for your application you can use the command below:

rails new .

Notice the period at the end telling it to use the current directory.

If you want to supply a specific application name, you’ll have to do the following:

rails new /path/to/folder/you/want/to/use



来源:https://stackoverflow.com/questions/6400988/why-does-my-rails-command-always-create-a-new-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!