From d96c5a8782b80de0d684f4e85747e459301353a5 Mon Sep 17 00:00:00 2001
From: Rashmi Yadav
Date: Fri, 18 Oct 2013 15:20:53 +0200
Subject: Updated 3.2.x link [ci skip]
---
guides/source/_welcome.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/_welcome.html.erb b/guides/source/_welcome.html.erb
index 0a0a958e30..93c177905c 100644
--- a/guides/source/_welcome.html.erb
+++ b/guides/source/_welcome.html.erb
@@ -15,7 +15,7 @@
<% end %>
- The guides for Rails 3.2.x are available at http://guides.rubyonrails.org/v3.2.14/.
+ The guides for Rails 3.2.x are available at http://guides.rubyonrails.org/v3.2.15/.
The guides for Rails 2.3.x are available at http://guides.rubyonrails.org/v2.3.11/.
--
cgit v1.2.3
From da1d2fb483b521419ce6c350bc6a5721266c0fc6 Mon Sep 17 00:00:00 2001
From: Jay Hayes
Date: Sat, 19 Oct 2013 10:33:47 -0500
Subject: Update I18n guide to note the additional features of the `translate`
view helper
---
guides/source/i18n.md | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/i18n.md b/guides/source/i18n.md
index 33daa79133..837a07ddbb 100644
--- a/guides/source/i18n.md
+++ b/guides/source/i18n.md
@@ -492,12 +492,14 @@ Overview of the I18n API Features
You should have good understanding of using the i18n library now, knowing all necessary aspects of internationalizing a basic Rails application. In the following chapters, we'll cover it's features in more depth.
+These chapters will show examples using both th `I18n.translate` method as well as the [`translate` view helper method](http://api.rubyonrails.org/classes/ActionView/Helpers/TranslationHelper.html#method-i-translate) (noting the additional feature provide by the view helper method).
+
Covered are features like these:
* looking up translations
* interpolating data into translations
* pluralizing translations
-* using safe HTML translations
+* using safe HTML translations (view helper method only)
* localizing dates, numbers, currency, etc.
### Looking up Translations
@@ -585,6 +587,8 @@ you can look up the `books.index.title` value **inside** `app/views/books/index.
<%= t '.title' %>
```
+NOTE: Automatic translation scoping by partial is only available from the `translate` view helper method.
+
### Interpolation
In many cases you want to abstract your translations so that **variables can be interpolated into the translation**. For this reason the I18n API provides an interpolation feature.
@@ -673,6 +677,8 @@ en:
<%= t('title.html') %>
```
+NOTE: Automatic conversion to HTML safe translate text is only available from the `translate` view helper method.
+

How to Store your Custom Translations
--
cgit v1.2.3
From e1e6be920de7f40a81fae1199ec2c220e0ced5be Mon Sep 17 00:00:00 2001
From: Harshad Sabne
Date: Sun, 20 Oct 2013 22:53:08 +0530
Subject: Update 3_2_release_notes.md
Code style adherence
---
guides/source/3_2_release_notes.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/3_2_release_notes.md b/guides/source/3_2_release_notes.md
index babdc5050e..a9484cf97a 100644
--- a/guides/source/3_2_release_notes.md
+++ b/guides/source/3_2_release_notes.md
@@ -375,7 +375,7 @@ Active Record
* Support index sort order in SQLite, MySQL and PostgreSQL adapters.
-* Allow the `:class_name` option for associations to take a symbol in addition to a string. This is to avoid confusing newbies, and to be consistent with the fact that other options like :foreign_key already allow a symbol or a string.
+* Allow the `:class_name` option for associations to take a symbol in addition to a string. This is to avoid confusing newbies, and to be consistent with the fact that other options like `:foreign_key` already allow a symbol or a string.
```ruby
has_many :clients, :class_name => :Client # Note that the symbol need to be capitalized
--
cgit v1.2.3
From 614b203e1d6a36b87fedd01fb35b1a3d53295754 Mon Sep 17 00:00:00 2001
From: Jay Hayes
Date: Sun, 20 Oct 2013 19:51:19 -0500
Subject: Fixes typo
---
guides/source/i18n.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/i18n.md b/guides/source/i18n.md
index 837a07ddbb..770b981af2 100644
--- a/guides/source/i18n.md
+++ b/guides/source/i18n.md
@@ -492,7 +492,7 @@ Overview of the I18n API Features
You should have good understanding of using the i18n library now, knowing all necessary aspects of internationalizing a basic Rails application. In the following chapters, we'll cover it's features in more depth.
-These chapters will show examples using both th `I18n.translate` method as well as the [`translate` view helper method](http://api.rubyonrails.org/classes/ActionView/Helpers/TranslationHelper.html#method-i-translate) (noting the additional feature provide by the view helper method).
+These chapters will show examples using both the `I18n.translate` method as well as the [`translate` view helper method](http://api.rubyonrails.org/classes/ActionView/Helpers/TranslationHelper.html#method-i-translate) (noting the additional feature provide by the view helper method).
Covered are features like these:
--
cgit v1.2.3
From 306651c7b3e9f6945c50bc13d0b9405ee7999069 Mon Sep 17 00:00:00 2001
From: Harshad Sabne
Date: Tue, 22 Oct 2013 23:09:46 +0530
Subject: Update 4_0_release_notes.md
Code Highlighted
---
guides/source/4_0_release_notes.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/4_0_release_notes.md b/guides/source/4_0_release_notes.md
index c4ca1e921f..3790beccdf 100644
--- a/guides/source/4_0_release_notes.md
+++ b/guides/source/4_0_release_notes.md
@@ -165,9 +165,9 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/a
### Notable changes
-* Replace deprecated `memcache-client` gem with `dalli` in ActiveSupport::Cache::MemCacheStore.
+* Replace deprecated `memcache-client` gem with `dalli` in `ActiveSupport::Cache::MemCacheStore`.
-* Optimize ActiveSupport::Cache::Entry to reduce memory and processing overhead.
+* Optimize `ActiveSupport::Cache::Entry` to reduce memory and processing overhead.
* Inflections can now be defined per locale. `singularize` and `pluralize` accept locale as an extra argument.
--
cgit v1.2.3
From a31bb063bcf525624aef17b0632fc13b2030e6ab Mon Sep 17 00:00:00 2001
From: Harshad Sabne
Date: Wed, 23 Oct 2013 22:32:29 +0530
Subject: Fixed URL link to rendered_component plugin [ci skip]
---
guides/source/2_3_release_notes.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/2_3_release_notes.md b/guides/source/2_3_release_notes.md
index c2002fb8fa..8c633fa169 100644
--- a/guides/source/2_3_release_notes.md
+++ b/guides/source/2_3_release_notes.md
@@ -604,7 +604,7 @@ Deprecated
A few pieces of older code are deprecated in this release:
* If you're one of the (fairly rare) Rails developers who deploys in a fashion that depends on the inspector, reaper, and spawner scripts, you'll need to know that those scripts are no longer included in core Rails. If you need them, you'll be able to pick up copies via the [irs_process_scripts](http://github.com/rails/irs_process_scripts/tree) plugin.
-* `render_component` goes from "deprecated" to "nonexistent" in Rails 2.3. If you still need it, you can install the [render_component plugin](http://github.com/rails/render_component/tree/master.)
+* `render_component` goes from "deprecated" to "nonexistent" in Rails 2.3. If you still need it, you can install the [render_component plugin](http://github.com/rails/render_component/tree/master).
* Support for Rails components has been removed.
* If you were one of the people who got used to running `script/performance/request` to look at performance based on integration tests, you need to learn a new trick: that script has been removed from core Rails now. There's a new request_profiler plugin that you can install to get the exact same functionality back.
* `ActionController::Base#session_enabled?` is deprecated because sessions are lazy-loaded now.
--
cgit v1.2.3
From b8a538625af2c9a3442a27eff4cf8318ba812ce7 Mon Sep 17 00:00:00 2001
From: Damien Mathieu <42@dmathieu.com>
Date: Thu, 24 Oct 2013 13:30:01 +0200
Subject: rephrase the overriding views part about the view path
See rails/rails#12608
---
guides/source/engines.md | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/engines.md b/guides/source/engines.md
index c71b728ef7..b9be764528 100644
--- a/guides/source/engines.md
+++ b/guides/source/engines.md
@@ -1,4 +1,4 @@
-Getting Started with Engines
+Getting Started wiith Engines
============================
In this guide you will learn about engines and how they can be used to provide additional functionality to their host applications through a clean and very easy-to-use interface.
@@ -598,7 +598,7 @@ By outputting `@post.author` using the `<%=` tag, the `to_s` method will be call
```
#
-```
+```i
This is undesirable and it would be much better to have the user's name there. To do this, add a `to_s` method to the `User` class within the application:
@@ -611,7 +611,7 @@ end
Now instead of the ugly Ruby object output the author's name will be displayed.
#### Using a controller provided by the application
-
+i
Because Rails controllers generally share code for things like authentication and accessing session variables, by default they inherit from `ApplicationController`. Rails engines, however are scoped to run independently from the main application, so each engine gets a scoped `ApplicationController`. This namespace prevents code collisions, but often engine controllers should access methods in the main application's `ApplicationController`. An easy way to provide this access is to change the engine's scoped `ApplicationController` to inherit from the main application's `ApplicationController`. For our Blorgh engine this would be done by changing `app/controllers/blorgh/application_controller.rb` to look like:
```ruby
@@ -702,7 +702,7 @@ an application. Same goes for if you want to use a standard initializer.
For locales, simply place the locale files in the `config/locales` directory, just like you would in an application.
-Testing an engine
+Testing an enginie
-----------------
When an engine is generated there is a smaller dummy application created inside it at `test/dummy`. This application is used as a mounting point for the engine to make testing the engine extremely simple. You may extend this application by generating controllers, models or views from within the directory, and then use those to test your engine.
@@ -725,7 +725,7 @@ get :index, use_route: :blorgh
This tells the application that you still want to perform a `GET` request to the `index` action of this controller, just that you want to use the engine's route to get there, rather than the application.
-Improving engine functionality
+Improving enginie functionality
------------------------------
This section explains how to add and/or override engine MVC functionality in the main Rails application.
@@ -746,7 +746,7 @@ Here is some sample code to do this:
```ruby
# lib/blorgh/engine.rb
-module Blorgh
+module Blorghi
class Engine < ::Rails::Engine
isolate_namespace Blorgh
@@ -763,12 +763,12 @@ This doesn't apply to just Decorators, but anything that you add in an engine
that isn't referenced by your main application.
#### Implementing Decorator Pattern Using Class#class_eval
-
+i
**Adding** `Post#time_since_created`,
```ruby
# MyApp/app/decorators/models/blorgh/post_decorator.rb
-
+i
Blorgh::Post.class_eval do
def time_since_created
Time.current - created_at
@@ -778,7 +778,7 @@ end
```ruby
# Blorgh/app/models/post.rb
-
+i
class Post < ActiveRecord::Base
has_many :comments
end
@@ -789,7 +789,7 @@ end
```ruby
# MyApp/app/decorators/models/blorgh/post_decorator.rb
-
+i
Blorgh::Post.class_eval do
def summary
"#{title} - #{truncate(text)}"
@@ -799,7 +799,7 @@ end
```ruby
# Blorgh/app/models/post.rb
-
+i
class Post < ActiveRecord::Base
has_many :comments
def summary
@@ -809,14 +809,14 @@ end
```
#### Implementing Decorator Pattern Using ActiveSupport::Concern
-
+i
Using `Class#class_eval` is great for simple adjustments, but for more complex class modifications, you might want to consider using [`ActiveSupport::Concern`](http://edgeapi.rubyonrails.org/classes/ActiveSupport/Concern.html). ActiveSupport::Concern manages load order of interlinked dependent modules and classes at run time allowing you to significantly modularize your code.
**Adding** `Post#time_since_created` and **Overriding** `Post#summary`
```ruby
# MyApp/app/models/blorgh/post.rb
-
+i
class Blorgh::Post < ActiveRecord::Base
include Blorgh::Concerns::Models::Post
@@ -832,7 +832,7 @@ end
```ruby
# Blorgh/app/models/post.rb
-
+i
class Post < ActiveRecord::Base
include Blorgh::Concerns::Models::Post
end
@@ -875,7 +875,7 @@ end
When Rails looks for a view to render, it will first look in the `app/views` directory of the application. If it cannot find the view there, then it will check in the `app/views` directories of all engines which have this directory.
-In the `blorgh` engine, there is a currently a file at `app/views/blorgh/posts/index.html.erb`. When the engine is asked to render the view for `Blorgh::PostsController`'s `index` action, it will first see if it can find it at `app/views/blorgh/posts/index.html.erb` within the application and then if it cannot it will look inside the engine.
+When the application is asked to render the view for `Blorgh::PostsController`'s index action, it will look the path `app/views/blorgh/posts/index.html.erb`, first within the application. If it cannot find it, it will look inside the engine.
You can override this view in the application by simply creating a new file at `app/views/blorgh/posts/index.html.erb`. Then you can completely change what this view would normally output.
--
cgit v1.2.3
From a0fe2f1fc8334ed083c82ca020cf91e9b1f0185b Mon Sep 17 00:00:00 2001
From: Damien Mathieu <42@dmathieu.com>
Date: Thu, 24 Oct 2013 13:33:13 +0200
Subject: fix typo introduced when searching in markdown document with vim
---
guides/source/engines.md | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/engines.md b/guides/source/engines.md
index b9be764528..af48768fe9 100644
--- a/guides/source/engines.md
+++ b/guides/source/engines.md
@@ -1,4 +1,4 @@
-Getting Started wiith Engines
+Getting Started with Engines
============================
In this guide you will learn about engines and how they can be used to provide additional functionality to their host applications through a clean and very easy-to-use interface.
@@ -598,7 +598,7 @@ By outputting `@post.author` using the `<%=` tag, the `to_s` method will be call
```
#
-```i
+```
This is undesirable and it would be much better to have the user's name there. To do this, add a `to_s` method to the `User` class within the application:
@@ -611,7 +611,7 @@ end
Now instead of the ugly Ruby object output the author's name will be displayed.
#### Using a controller provided by the application
-i
+
Because Rails controllers generally share code for things like authentication and accessing session variables, by default they inherit from `ApplicationController`. Rails engines, however are scoped to run independently from the main application, so each engine gets a scoped `ApplicationController`. This namespace prevents code collisions, but often engine controllers should access methods in the main application's `ApplicationController`. An easy way to provide this access is to change the engine's scoped `ApplicationController` to inherit from the main application's `ApplicationController`. For our Blorgh engine this would be done by changing `app/controllers/blorgh/application_controller.rb` to look like:
```ruby
@@ -702,7 +702,7 @@ an application. Same goes for if you want to use a standard initializer.
For locales, simply place the locale files in the `config/locales` directory, just like you would in an application.
-Testing an enginie
+Testing an engine
-----------------
When an engine is generated there is a smaller dummy application created inside it at `test/dummy`. This application is used as a mounting point for the engine to make testing the engine extremely simple. You may extend this application by generating controllers, models or views from within the directory, and then use those to test your engine.
@@ -725,7 +725,7 @@ get :index, use_route: :blorgh
This tells the application that you still want to perform a `GET` request to the `index` action of this controller, just that you want to use the engine's route to get there, rather than the application.
-Improving enginie functionality
+Improving engine functionality
------------------------------
This section explains how to add and/or override engine MVC functionality in the main Rails application.
@@ -746,7 +746,7 @@ Here is some sample code to do this:
```ruby
# lib/blorgh/engine.rb
-module Blorghi
+module Blorgh
class Engine < ::Rails::Engine
isolate_namespace Blorgh
@@ -763,12 +763,12 @@ This doesn't apply to just Decorators, but anything that you add in an engine
that isn't referenced by your main application.
#### Implementing Decorator Pattern Using Class#class_eval
-i
+
**Adding** `Post#time_since_created`,
```ruby
# MyApp/app/decorators/models/blorgh/post_decorator.rb
-i
+
Blorgh::Post.class_eval do
def time_since_created
Time.current - created_at
@@ -778,7 +778,7 @@ end
```ruby
# Blorgh/app/models/post.rb
-i
+
class Post < ActiveRecord::Base
has_many :comments
end
@@ -789,7 +789,7 @@ end
```ruby
# MyApp/app/decorators/models/blorgh/post_decorator.rb
-i
+
Blorgh::Post.class_eval do
def summary
"#{title} - #{truncate(text)}"
@@ -799,7 +799,7 @@ end
```ruby
# Blorgh/app/models/post.rb
-i
+
class Post < ActiveRecord::Base
has_many :comments
def summary
@@ -809,14 +809,14 @@ end
```
#### Implementing Decorator Pattern Using ActiveSupport::Concern
-i
+
Using `Class#class_eval` is great for simple adjustments, but for more complex class modifications, you might want to consider using [`ActiveSupport::Concern`](http://edgeapi.rubyonrails.org/classes/ActiveSupport/Concern.html). ActiveSupport::Concern manages load order of interlinked dependent modules and classes at run time allowing you to significantly modularize your code.
**Adding** `Post#time_since_created` and **Overriding** `Post#summary`
```ruby
# MyApp/app/models/blorgh/post.rb
-i
+
class Blorgh::Post < ActiveRecord::Base
include Blorgh::Concerns::Models::Post
@@ -832,7 +832,7 @@ end
```ruby
# Blorgh/app/models/post.rb
-i
+
class Post < ActiveRecord::Base
include Blorgh::Concerns::Models::Post
end
--
cgit v1.2.3
From 97ad84e10d222f796811c69cd8577a62ac74d838 Mon Sep 17 00:00:00 2001
From: Zachary Scott
Date: Mon, 28 Oct 2013 13:56:32 -0400
Subject: guides/rails_on_rack: Fix formatting of _Internal Middleware Stack_
section
---
guides/source/rails_on_rack.md | 46 +++++++++++++++++++++---------------------
1 file changed, 23 insertions(+), 23 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md
index d53e0cd2bd..2cdf4ea6a9 100644
--- a/guides/source/rails_on_rack.md
+++ b/guides/source/rails_on_rack.md
@@ -225,95 +225,95 @@ config.middleware.delete "Rack::MethodOverride"
Much of Action Controller's functionality is implemented as Middlewares. The following list explains the purpose of each of them:
- **`Rack::Sendfile`**
+**`Rack::Sendfile`**
* Sets server specific X-Sendfile header. Configure this via `config.action_dispatch.x_sendfile_header` option.
- **`ActionDispatch::Static`**
+**`ActionDispatch::Static`**
* Used to serve static assets. Disabled if `config.serve_static_assets` is `false`.
- **`Rack::Lock`**
+**`Rack::Lock`**
* Sets `env["rack.multithread"]` flag to `false` and wraps the application within a Mutex.
- **`ActiveSupport::Cache::Strategy::LocalCache::Middleware`**
+**`ActiveSupport::Cache::Strategy::LocalCache::Middleware`**
* Used for memory caching. This cache is not thread safe.
- **`Rack::Runtime`**
+**`Rack::Runtime`**
* Sets an X-Runtime header, containing the time (in seconds) taken to execute the request.
- **`Rack::MethodOverride`**
+**`Rack::MethodOverride`**
* Allows the method to be overridden if `params[:_method]` is set. This is the middleware which supports the PUT and DELETE HTTP method types.
- **`ActionDispatch::RequestId`**
+**`ActionDispatch::RequestId`**
* Makes a unique `X-Request-Id` header available to the response and enables the `ActionDispatch::Request#uuid` method.
- **`Rails::Rack::Logger`**
+**`Rails::Rack::Logger`**
* Notifies the logs that the request has began. After request is complete, flushes all the logs.
- **`ActionDispatch::ShowExceptions`**
+**`ActionDispatch::ShowExceptions`**
* Rescues any exception returned by the application and calls an exceptions app that will wrap it in a format for the end user.
- **`ActionDispatch::DebugExceptions`**
+**`ActionDispatch::DebugExceptions`**
* Responsible for logging exceptions and showing a debugging page in case the request is local.
- **`ActionDispatch::RemoteIp`**
+**`ActionDispatch::RemoteIp`**
* Checks for IP spoofing attacks.
- **`ActionDispatch::Reloader`**
+**`ActionDispatch::Reloader`**
* Provides prepare and cleanup callbacks, intended to assist with code reloading during development.
- **`ActionDispatch::Callbacks`**
+**`ActionDispatch::Callbacks`**
* Runs the prepare callbacks before serving the request.
- **`ActiveRecord::Migration::CheckPending`**
+**`ActiveRecord::Migration::CheckPending`**
* Checks pending migrations and raises `ActiveRecord::PendingMigrationError` if any migrations are pending.
- **`ActiveRecord::ConnectionAdapters::ConnectionManagement`**
+**`ActiveRecord::ConnectionAdapters::ConnectionManagement`**
* Cleans active connections after each request, unless the `rack.test` key in the request environment is set to `true`.
- **`ActiveRecord::QueryCache`**
+**`ActiveRecord::QueryCache`**
* Enables the Active Record query cache.
- **`ActionDispatch::Cookies`**
+**`ActionDispatch::Cookies`**
* Sets cookies for the request.
- **`ActionDispatch::Session::CookieStore`**
+**`ActionDispatch::Session::CookieStore`**
* Responsible for storing the session in cookies.
- **`ActionDispatch::Flash`**
+**`ActionDispatch::Flash`**
* Sets up the flash keys. Only available if `config.action_controller.session_store` is set to a value.
- **`ActionDispatch::ParamsParser`**
+**`ActionDispatch::ParamsParser`**
* Parses out parameters from the request into `params`.
- **`ActionDispatch::Head`**
+**`ActionDispatch::Head`**
* Converts HEAD requests to `GET` requests and serves them as so.
- **`Rack::ConditionalGet`**
+**`Rack::ConditionalGet`**
* Adds support for "Conditional `GET`" so that server responds with nothing if page wasn't changed.
- **`Rack::ETag`**
+**`Rack::ETag`**
* Adds ETag header on all String bodies. ETags are used to validate cache.
--
cgit v1.2.3
From 49062c12edc4b5397ea3bc6680eb6a13bdec2164 Mon Sep 17 00:00:00 2001
From: Rashmi Yadav
Date: Fri, 1 Nov 2013 18:07:27 +0100
Subject: exists? is deprecated in ruby trunk [ci skip]
see here 4d4ff531b8807ee88a3fc46875c7e76f613956fb
---
guides/source/active_record_callbacks.md | 4 ++--
guides/source/initialization.md | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/active_record_callbacks.md b/guides/source/active_record_callbacks.md
index aa2ce99f6d..cabcf0c7c8 100644
--- a/guides/source/active_record_callbacks.md
+++ b/guides/source/active_record_callbacks.md
@@ -290,7 +290,7 @@ Here's an example where we create a class with an `after_destroy` callback for a
```ruby
class PictureFileCallbacks
def after_destroy(picture_file)
- if File.exists?(picture_file.filepath)
+ if File.exist?(picture_file.filepath)
File.delete(picture_file.filepath)
end
end
@@ -310,7 +310,7 @@ Note that we needed to instantiate a new `PictureFileCallbacks` object, since we
```ruby
class PictureFileCallbacks
def self.after_destroy(picture_file)
- if File.exists?(picture_file.filepath)
+ if File.exist?(picture_file.filepath)
File.delete(picture_file.filepath)
end
end
diff --git a/guides/source/initialization.md b/guides/source/initialization.md
index fe6b1ad906..7e9cb5a47d 100644
--- a/guides/source/initialization.md
+++ b/guides/source/initialization.md
@@ -54,7 +54,7 @@ The `APP_PATH` constant will be used later in `rails/commands`. The `config/boot
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
-require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
+require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
```
In a standard Rails application, there's a `Gemfile` which declares all
@@ -121,7 +121,7 @@ when 'server'
# Change to the application's path if there is no config.ru file in current directory.
# This allows us to run `rails server` from other directories, but still get
# the main config.ru and properly set the tmp directory.
- Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru"))
+ Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exist?(File.expand_path("config.ru"))
require 'rails/commands/server'
Rails::Server.new.tap do |server|
--
cgit v1.2.3
From aa330d0d7a694bde5c4e9f2976eb21a71a8be9f3 Mon Sep 17 00:00:00 2001
From: Rashmi Yadav
Date: Mon, 4 Nov 2013 21:55:07 +0100
Subject: Fixed code syntax for config.ru [ci skip]
---
guides/source/rails_on_rack.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md
index 2cdf4ea6a9..7ef54a45bc 100644
--- a/guides/source/rails_on_rack.md
+++ b/guides/source/rails_on_rack.md
@@ -83,7 +83,7 @@ To use `rackup` instead of Rails' `rails server`, you can put the following insi
# Rails.root/config.ru
require ::File.expand_path('../config/environment', __FILE__)
-use Rack::Debugger
+use Rails::Rack::Debugger
use Rack::ContentLength
run Rails.application
```
--
cgit v1.2.3
From cb632188b33c2eaf7505c3df85e5ced354cbe2d2 Mon Sep 17 00:00:00 2001
From: Alex Johnson
Date: Wed, 6 Nov 2013 18:24:22 +0530
Subject: Update Rails initialization guide to explain how bin/rails is
executed
---
guides/source/initialization.md | 39 ++++++++++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/initialization.md b/guides/source/initialization.md
index 7e9cb5a47d..33eb74dcd9 100644
--- a/guides/source/initialization.md
+++ b/guides/source/initialization.md
@@ -29,9 +29,42 @@ quickly.
Launch!
-------
-Let's start to boot and initialize the app. It all begins with your app's
-`bin/rails` executable. A Rails application is usually started by running
-`rails console` or `rails server`.
+Let's start to boot and initialize the app. A Rails application is usually
+started by running `rails console` or `rails server`.
+
+### `railties/bin/rails`
+
+The `rails` in the command `rails server` is a ruby executable in your load
+path. This executable contains the following lines:
+
+```ruby
+version = ">= 0"
+load Gem.bin_path('railties', 'rails', version)
+```
+
+If you try out this command in a Rails console, you would see that this loads
+`railties/bin/rails`. A part of the file `railties/bin/rails.rb` has the
+following code:
+
+```ruby
+require "rails/cli"
+```
+
+The file `railties/lib/rails/cli` in turn calls
+`Rails::AppRailsLoader.exec_app_rails`.
+
+### `railties/lib/rails/app_rails_loader.rb`
+
+The primary goal of the function `exec_app_rails` is to execute your app's
+`bin/rails`. If the current directory does not have a `bin/rails`, it will
+navigate upwards until it finds a `bin/rails` executable. Thus one can invoke a
+`rails` command from anywhere inside a rails application.
+
+For `rails server` the equivalent of the following command is executed:
+
+```bash
+$ exec ruby bin/rails server
+```
### `bin/rails`
--
cgit v1.2.3