From 603e0f155d66e2cab56caa65d007c7ba6c6cf03b Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 26 Dec 2010 22:10:56 +0530 Subject: use new routes in templates --- railties/guides/source/rails_application_templates.textile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'railties/guides/source/rails_application_templates.textile') diff --git a/railties/guides/source/rails_application_templates.textile b/railties/guides/source/rails_application_templates.textile index d4b887ad02..ca4f7798a6 100644 --- a/railties/guides/source/rails_application_templates.textile +++ b/railties/guides/source/rails_application_templates.textile @@ -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+ : @@ -183,7 +183,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 : -route "map.root :controller => :person" +route "root :to => 'person#index'" h4. inside(dir) -- cgit v1.2.3 From e85631849725b74d6ef59e4033ed62ced11e910b Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 26 Dec 2010 22:57:45 +0530 Subject: changed template gist to reflect Rails 3 and documented the add_source method to source gems from different locations --- railties/guides/source/rails_application_templates.textile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'railties/guides/source/rails_application_templates.textile') diff --git a/railties/guides/source/rails_application_templates.textile b/railties/guides/source/rails_application_templates.textile index ca4f7798a6..642aed661b 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 : -$ rails new blog -m http://gist.github.com/31208.txt +$ rails new blog -m https://gist.github.com/755496.txt Alternatively, you can use the rake task +rails:template+ to apply a template to an existing Rails application : @@ -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": + + +add_source "http://code.whytheluckystiff.net" + + h4. plugin(name, options = {}) Installs a plugin to the generated application. -- cgit v1.2.3 From 50a2edbce6a66eeb829eeb072483670b8a9be8d7 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 26 Dec 2010 23:00:03 +0530 Subject: fix spacing --- railties/guides/source/rails_application_templates.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides/source/rails_application_templates.textile') diff --git a/railties/guides/source/rails_application_templates.textile b/railties/guides/source/rails_application_templates.textile index 642aed661b..8f87b4cd58 100644 --- a/railties/guides/source/rails_application_templates.textile +++ b/railties/guides/source/rails_application_templates.textile @@ -66,7 +66,7 @@ rake "gems:install" And let Rails take care of installing the required gems if they’re not already installed. -h4. add_source(source, options={}) +h4. add_source(source, options = {}) Adds the given source to the generated application's +Gemfile+. -- cgit v1.2.3