From 407e7d499cd9018e112f4f64c404432959820233 Mon Sep 17 00:00:00 2001 From: Will Gray Date: Fri, 9 Nov 2012 15:09:50 -0600 Subject: Update guides/source/rails_application_templates.md Update function signatures for `#gem` and `#generate`. --- guides/source/rails_application_templates.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'guides/source/rails_application_templates.md') diff --git a/guides/source/rails_application_templates.md b/guides/source/rails_application_templates.md index ee5fbcfd52..c3d4c4901e 100644 --- a/guides/source/rails_application_templates.md +++ b/guides/source/rails_application_templates.md @@ -46,7 +46,7 @@ git :commit => %Q{ -m 'Initial commit' } The following sections outlines the primary methods provided by the API: -### gem(name, options = {}) +### gem(*args) Adds a `gem` entry for the supplied gem to the generated application’s `Gemfile`. @@ -136,7 +136,7 @@ end The above creates `lib/tasks/bootstrap.rake` with a `boot:strap` rake task. -### generate(what, args) +### generate(what, *args) Runs the supplied rails generator with given arguments. @@ -168,7 +168,7 @@ rake "db:migrate", :env => 'production' ### 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: +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 "root :to => 'person#index'" -- cgit v1.2.3 From dcf401e3bc7163aefab856abe7f1d238025c4ef9 Mon Sep 17 00:00:00 2001 From: Will Gray Date: Fri, 9 Nov 2012 15:10:39 -0600 Subject: Update guides/source/rails_application_templates.md Add `#environment` --- guides/source/rails_application_templates.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'guides/source/rails_application_templates.md') diff --git a/guides/source/rails_application_templates.md b/guides/source/rails_application_templates.md index c3d4c4901e..20944ab258 100644 --- a/guides/source/rails_application_templates.md +++ b/guides/source/rails_application_templates.md @@ -85,6 +85,18 @@ For example, if you need to source a gem from "http://code.whytheluckystiff.net" add_source "http://code.whytheluckystiff.net" ``` +### environment/application(data=nil, options={}, &block) + +Adds a line inside the `Application` class for `config/application.rb`. + +If options `:env` is specified, the line is appended to the corresponding file in `config/environments`. + +```ruby +environment 'config.action_mailer.default_url_options = { :host => 'http://yourwebsite.example.com' }, :env => 'production' +``` + +A block can be used in place of the `data` argument. + ### vendor/lib/file/initializer(filename, data = nil, &block) Adds an initializer to the generated application’s `config/initializers` directory. -- cgit v1.2.3 From 8b178b3f480553bedc09683371df0aa87a421975 Mon Sep 17 00:00:00 2001 From: Agis Anastasopoulos Date: Fri, 16 Nov 2012 12:30:12 +0200 Subject: Switch to 1.9 hash syntax (guides) --- guides/source/rails_application_templates.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'guides/source/rails_application_templates.md') diff --git a/guides/source/rails_application_templates.md b/guides/source/rails_application_templates.md index 20944ab258..0f2c987328 100644 --- a/guides/source/rails_application_templates.md +++ b/guides/source/rails_application_templates.md @@ -36,12 +36,12 @@ 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 "root :to => 'people#index'" +route "root to: 'people#index'" rake("db:migrate") git :init -git :add => "." -git :commit => %Q{ -m 'Initial commit' } +git add: "." +git commit: %Q{ -m 'Initial commit' } ``` The following sections outlines the primary methods provided by the API: @@ -92,7 +92,7 @@ Adds a line inside the `Application` class for `config/application.rb`. If options `:env` is specified, the line is appended to the corresponding file in `config/environments`. ```ruby -environment 'config.action_mailer.default_url_options = { :host => 'http://yourwebsite.example.com' }, :env => 'production' +environment 'config.action_mailer.default_url_options = {host: 'http://yourwebsite.example.com'}, env: 'production' ``` A block can be used in place of the `data` argument. @@ -175,7 +175,7 @@ rake "db:migrate" You can also run rake tasks with a different Rails environment: ```ruby -rake "db:migrate", :env => 'production' +rake "db:migrate", env: 'production' ``` ### route(routing_code) @@ -183,7 +183,7 @@ rake "db:migrate", :env => 'production' 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 "root :to => 'person#index'" +route "root to: 'person#index'" ``` ### inside(dir) @@ -225,6 +225,6 @@ Rails templates let you run any git command: ```ruby git :init -git :add => "." -git :commit => "-a -m 'Initial commit'" +git add: "." +git commit: "-a -m 'Initial commit'" ``` -- cgit v1.2.3 From e7ba7c3b95be4f46d7d27fcfd82dd4865c159393 Mon Sep 17 00:00:00 2001 From: Agis Anastasopoulos Date: Fri, 16 Nov 2012 12:31:14 +0200 Subject: Remove unnecessary whitespace --- guides/source/rails_application_templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source/rails_application_templates.md') diff --git a/guides/source/rails_application_templates.md b/guides/source/rails_application_templates.md index 0f2c987328..46828b8737 100644 --- a/guides/source/rails_application_templates.md +++ b/guides/source/rails_application_templates.md @@ -215,7 +215,7 @@ CODE These methods let you ask questions from templates and decide the flow based on the user’s answer. Lets say you want to freeze rails only if the user want to: ```ruby -rake("rails:freeze:gems") if yes?("Freeze rails gems ?") +rake("rails:freeze:gems") if yes?("Freeze rails gems?") # no?(question) acts just the opposite. ``` -- cgit v1.2.3 From 1fd008cd44cd2eea37db57ee6b3c17d3585d88c1 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 17 Nov 2012 01:13:52 +0530 Subject: copy edits and fixes [ci skip] --- guides/source/rails_application_templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source/rails_application_templates.md') diff --git a/guides/source/rails_application_templates.md b/guides/source/rails_application_templates.md index 46828b8737..6cd19eb8e9 100644 --- a/guides/source/rails_application_templates.md +++ b/guides/source/rails_application_templates.md @@ -89,7 +89,7 @@ add_source "http://code.whytheluckystiff.net" Adds a line inside the `Application` class for `config/application.rb`. -If options `:env` is specified, the line is appended to the corresponding file in `config/environments`. +If `options[:env]` is specified, the line is appended to the corresponding file in `config/environments`. ```ruby environment 'config.action_mailer.default_url_options = {host: 'http://yourwebsite.example.com'}, env: 'production' -- cgit v1.2.3