我正在按照中的教程学习ruby on railshttp://ruby.railstutorial.org/。
当我试图创建一个新项目时,我得到了无效的选项错误,如下所示,
user1@ubuntu:~/rails_projects$ rails new sample_app -T
**invalid option: -T**
我在rails手册页中也找不到-t选项。
user1@ubuntu:~/rails_projects$ rails --help new
Usage: /usr/share/rails-ruby1.8/railties/bin/rails /path/to/your/app [options]
Options:
-r, --ruby=path Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).
Default: /usr/bin/ruby1.8
-d, --database=name Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3/frontbase/ibm_db).
Default: sqlite3
-D, --with-dispatchers Add CGI/FastCGI/mod_ruby dispatches code to generated application skeleton
Default: false
--freeze Freeze Rails in vendor/rails from the gems generating the skeleton
Default: false
-m, --template=path Use an application template that lives at path (can be a filesystem path or URL).
Default: (none)
Rails Info:
-v, --version Show the Rails version number and quit.
-h, --help Show this help message and quit.
General Options:
-p, --pretend Run but do not make any changes.
-f, --force Overwrite files that already exist.
-s, --skip Skip files that already exist.
-q, --quiet Suppress normal output.
-t, --backtrace Debugging: show backtrace on errors.
-c, --svn Modify files with subversion. (Note: svn must be in path)
-g, --git Modify files with git. (Note: git must be in path)
Description:
The 'rails' command creates a new Rails application with a default
directory structure and configuration at the path you specify.
Example:
rails ~/Code/Ruby/weblog
This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
See the README in the newly created application to get going.
user1@ubuntu:~/rails_projects$ rvm notes
为什么它不可用的想法。
谢谢你的帮助。
这是ruby&轨道安装细节,
user1@ubuntu:~/rails_projects$ rails -v
Rails 2.3.5
user1@ubuntu:~/rails_projects$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
user1@ubuntu:~/rails_projects$
显然,您使用的是旧版本的rails(可能是2.x),但使用Rails3.x语法创建应用程序。请注意问题中的示例:
Example:
rails ~/Code/Ruby/weblog
因此,省略"new"并键入rails sample_app
。这是用于在旧版本(<3.x)的rails中创建应用程序的命令。
在Rails3.x中,创建新应用程序的方法是使用"new":rails new sample_app
理想情况下,您应该使用最新的稳定导轨(v3.0.x),在这种情况下,还可以使用-T
选项。
要使用rvm:正确设置系统
rvm install 1.8.7 #install Ruby 1.8.7
rvm use 1.8.7 --default #always use 1.8.7 by default when you open a terminal
ruby -v #should show ruby 1.8.7 .....
gem install rails #install the latest stable version of Rails
rails -v #should show Rails 3.something.something
rails --help #should show you the -T option now
注意:不要键入#
及其后面的内容。它只是向您展示命令的作用。