diff options
author | Emilio Tagua <miloops@gmail.com> | 2011-02-15 12:01:04 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2011-02-15 12:01:04 -0300 |
commit | 8ee0b4414890f919594c1a388d987b5b7364a505 (patch) | |
tree | 6c6c6aa19da0eb8066d2f0b9b02b08f2cc696c29 /railties/guides/source/rails_application_templates.textile | |
parent | 348c0ec7c656b3691aa4e687565d28259ca0f693 (diff) | |
parent | c9f1ab5365319e087e1b010a3f90626a2b8f080b (diff) | |
download | rails-8ee0b4414890f919594c1a388d987b5b7364a505.tar.gz rails-8ee0b4414890f919594c1a388d987b5b7364a505.tar.bz2 rails-8ee0b4414890f919594c1a388d987b5b7364a505.zip |
Merge remote branch 'rails/master' into identity_map
Conflicts:
activerecord/examples/performance.rb
activerecord/lib/active_record/association_preload.rb
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations/association_proxy.rb
activerecord/lib/active_record/autosave_association.rb
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/nested_attributes.rb
activerecord/test/cases/relations_test.rb
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) |