diff options
author | Xavier Noria <fxn@hashref.com> | 2010-12-29 23:46:03 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-12-29 23:46:03 +0100 |
commit | 69765aad8bcc853e7ab6b0e79f4edece2cdd7fe2 (patch) | |
tree | cbff92b476133e56dfdc4cfbdf2f5ecb6cfca2c3 /railties/guides/source/rails_application_templates.textile | |
parent | 0ac66caac5581c4793d120c8ad4a2cf4137f6ce2 (diff) | |
parent | 6f58b9ad5331d3619fc68a4706d5f85a95510a63 (diff) | |
download | rails-69765aad8bcc853e7ab6b0e79f4edece2cdd7fe2.tar.gz rails-69765aad8bcc853e7ab6b0e79f4edece2cdd7fe2.tar.bz2 rails-69765aad8bcc853e7ab6b0e79f4edece2cdd7fe2.zip |
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'railties/guides/source/rails_application_templates.textile')
-rw-r--r-- | railties/guides/source/rails_application_templates.textile | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/railties/guides/source/rails_application_templates.textile b/railties/guides/source/rails_application_templates.textile index d4b887ad02..8f87b4cd58 100644 --- a/railties/guides/source/rails_application_templates.textile +++ b/railties/guides/source/rails_application_templates.textile @@ -20,7 +20,7 @@ $ rails new blog -m ~/template.rb It's also possible to apply a template using a URL : <shell> -$ rails new blog -m http://gist.github.com/31208.txt +$ rails new blog -m https://gist.github.com/755496.txt </shell> Alternatively, you can use the rake task +rails:template+ to apply a template to an existing Rails application : @@ -37,7 +37,7 @@ Rails templates API is very self explanatory and easy to understand. Here's an e # template.rb run "rm public/index.html" generate(:scaffold, "person name:string") -route "map.root :controller => 'people'" +route "root :to => 'people#index'" rake("db:migrate") git :init @@ -49,7 +49,7 @@ The following sections outlines the primary methods provided by the API : h4. gem(name, options = {}) -Adds a +config.gem+ entry for the supplied gem to the generated application’s +config/environment.rb+. +Adds a +gem+ entry for the supplied gem to the generated application’s +Gemfile+. For example, if your application depends on the gems +bj+ and +nokogiri+ : @@ -66,6 +66,16 @@ rake "gems:install" And let Rails take care of installing the required gems if they’re not already installed. +h4. add_source(source, options = {}) + +Adds the given source to the generated application's +Gemfile+. + +For example, if you need to source a gem from "http://code.whytheluckystiff.net": + +<ruby> +add_source "http://code.whytheluckystiff.net" +</ruby> + h4. plugin(name, options = {}) Installs a plugin to the generated application. @@ -183,7 +193,7 @@ h4. route(routing_code) This adds a routing entry to the +config/routes.rb+ file. In above steps, we generated a person scaffold and also removed +public/index.html+. Now to make +PeopleController#index+ as the default page for the application : <ruby> -route "map.root :controller => :person" +route "root :to => 'person#index'" </ruby> h4. inside(dir) |