rails new --help
Usage:
rails new APP_PATH [options]
Options:
-d, [--database=DATABASE] # Preconfigure for selected database
(options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
# Default: sqlite3
-J, [--skip-prototype] # Skip Prototype files
-T, [--skip-testunit] # Skip TestUnit files
[--dev] # Setup the application with Gemfile
pointing to your Rails checkout
-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 an application builder (can be
a filesystem path or URL)
[--edge] # Setup the application with Gemfile
pointing to Rails repository
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /usr/bin/ruby
[--skip-gemfile] # Don't create a Gemfile
-O, [--skip-activerecord] # Skip ActiveRecord files
Runtime options:
-p, [--pretend] # Run but do not make any changes
-s, [--skip] # Skip files that already exist
-q, [--quiet] # Supress status output
-f, [--force] # Overwrite files that already exist
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.
Actually, I'm just doing some benchmark tests and I'm not that worried at the moment about this. I remember reading somewhere it was possible for not using an ORM in Rails 3 too but wasn't finding how on documentation. I'm just glad this is already solved on Rails master, needing maybe only a change in the option name from --skip-activerecord to --skip-active-record as Xavier noted. I don't really care about the option name, but I'm glad this is solved since sometime I might need setting up a Rails 3 application without any databases or without ActiveRecord.
For my benchmark tests it is just easier for me to install the activerecord-jdbcsqlite3-adapter gem.
This may be unrelated but I am curious and wondered if someone could
clear something up for me. With the options I understand what is
between the brackets are optional, but what does the first flag
signify? For example; -T [--skip-testunit]. I know I would type rails
new myapp --skip-testunit , so I am a little confused as to what the -
T is.
This may be unrelated but I am curious and wondered if someone could
clear something up for me. With the options I understand what is
between the brackets are optional, but what does the first flag
signify? For example; -T [--skip-testunit]. I know I would type rails
new myapp --skip-testunit , so I am a little confused as to what the -
T is.
what's in the brackets is an optional syntax for the first flag; i.e. you can do
Great! Maybe there should be some explanations on how to disable ORM after the project is created or how to enable ActiveRecord after the project has been created with --skip-active-record. Sometimes, one may start developing the UI and later then start using an ORM.
It used to be explained how to disable ActiveRecord in Rails 2 environment.rb.
Or maybe it is already done. It has been a while from the last time I used Rails master...
Thor is not available.
If you ran this command from a git checkout of Rails, please make sure thor is installed,
and run this command as `ruby /path/to/rails new myapp --dev`
Installing Thor wasn't enough for changing this message. Then, I guessed I should try "bundle install". But it didn't work too:
/home/rodrigo/src/git/rails/Gemfile:22:in `evaluate': undefined method `platforms' for #<Bundler::Dsl:0x7f470583e4f8> (NoMethodError)
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/lib/bundler/definition.rb:12:in `from_gemfile'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/lib/bundler.rb:114:in `definition'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/lib/bundler/cli.rb:91:in `install'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/lib/bundler/vendor/thor/task.rb:33:in `send'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/lib/bundler/vendor/thor/task.rb:33:in `run'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/lib/bundler/vendor/thor/invocation.rb:109:in `invoke'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/lib/bundler/vendor/thor/invocation.rb:116:in `call'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/lib/bundler/vendor/thor/invocation.rb:116:in `invoke'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/lib/bundler/vendor/thor.rb:137:in `start'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/lib/bundler/vendor/thor/base.rb:378:in `start'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/lib/bundler/vendor/thor.rb:124:in `start'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/gems/bundler-0.9.26/bin/bundle:13
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/bin/bundle:19:in `load'
from /home/rodrigo/.rvm/gems/ruby-1.8.7-p174@rails-master/bin/bundle:19
Maybe it would be useful to include a new file README_FOR_GIT_MASTER.
"gem install bundler --pre" allowed me to "bundle install".
But 'bin/rails --help' still yields:
Thor is not available.
If you ran this command from a git checkout of Rails, please make sure thor is installed,
and run this command as `ruby /path/to/rails new myapp --dev`
After running bundler, Thor is installed, as shown by "gem list":
Right, so how about changing an existing app to not use ActiveRecord? The app generator doesn’t allow generating over existing files (a decision I don’t understand). And even if it did, we would have to overwrite application.rb which is one of the 2 files that get customizations after generating a new app. Then we would have to bring back our customizations to the newly generated file. Either way you take it, it’s a lot of work.
My suggestion is never using “rails/all.rb” . I liked the older app generator when we got require statements for each of the frameworks:
require “active_record/railtie”
require “action_controller/railtie”
…
If we want to disable one, we just need to comment it out (same what --skip-activerecord) does.