Why does my rails command always create a new application?

前端 未结 6 2040
执笔经年
执笔经年 2021-02-19 06:20

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 gen

相关标签:
6条回答
  • 2021-02-19 07:10

    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.

    0 讨论(0)
  • 2021-02-19 07:13

    For creating project in current directory, you can run:

    rails new .
    
    0 讨论(0)
  • 2021-02-19 07:16

    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.

    0 讨论(0)
  • 2021-02-19 07:19

    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

    0 讨论(0)
  • 2021-02-19 07:20

    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

    0 讨论(0)
  • 2021-02-19 07:25

    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.

    0 讨论(0)
提交回复
热议问题