diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2014-04-13 10:28:56 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2014-04-13 10:28:56 -0300 |
commit | 8b3ff37cb77e1f3976e6108b67414d0666f36574 (patch) | |
tree | 961ac393d67fdd7bacc675ff7ed9c41542416d67 /guides/source | |
parent | 090db0ff7d2611846aef0b38f741dda6204849ce (diff) | |
parent | 2ddbe87e7acc324ce7e0a4784c4d10b79cc49a40 (diff) | |
download | rails-8b3ff37cb77e1f3976e6108b67414d0666f36574.tar.gz rails-8b3ff37cb77e1f3976e6108b67414d0666f36574.tar.bz2 rails-8b3ff37cb77e1f3976e6108b67414d0666f36574.zip |
Merge pull request #14718 from mcmorgan/update-documentation-to-match-generated-config
Update documentation to use Rails.application instead
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/action_controller_overview.md | 6 | ||||
-rw-r--r-- | guides/source/getting_started.md | 2 | ||||
-rw-r--r-- | guides/source/i18n.md | 2 | ||||
-rw-r--r-- | guides/source/initialization.md | 2 | ||||
-rw-r--r-- | guides/source/rails_on_rack.md | 9 | ||||
-rw-r--r-- | guides/source/routing.md | 4 |
6 files changed, 12 insertions, 13 deletions
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index d788d13ac9..ee2b00aedb 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -364,21 +364,21 @@ If you need a different session storage mechanism, you can change it in the `con # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rails g active_record:session_migration") -# YourApp::Application.config.session_store :active_record_store +# Rails.application.config.session_store :active_record_store ``` Rails sets up a session key (the name of the cookie) when signing the session data. These can also be changed in `config/initializers/session_store.rb`: ```ruby # Be sure to restart your server when you modify this file. -YourApp::Application.config.session_store :cookie_store, key: '_your_app_session' +Rails.application.config.session_store :cookie_store, key: '_your_app_session' ``` You can also pass a `:domain` key and specify the domain name for the cookie: ```ruby # Be sure to restart your server when you modify this file. -YourApp::Application.config.session_store :cookie_store, key: '_your_app_session', domain: ".example.com" +Rails.application.config.session_store :cookie_store, key: '_your_app_session', domain: ".example.com" ``` Rails sets up (for the CookieStore) a secret key used for signing the session data. This can be changed in `config/secrets.yml` diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index c54c9efe94..bafb75c668 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -344,7 +344,7 @@ resource. Here's what `config/routes.rb` should look like after the _article resource_ is declared. ```ruby -Blog::Application.routes.draw do +Rails.application.routes.draw do resources :articles diff --git a/guides/source/i18n.md b/guides/source/i18n.md index 6bd033f0de..466ffe7907 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -309,7 +309,7 @@ You most probably have something like this in one of your applications: ```ruby # config/routes.rb -Yourapp::Application.routes.draw do +Rails.application.routes.draw do root to: "home#index" end ``` diff --git a/guides/source/initialization.md b/guides/source/initialization.md index ca5fcbbcbd..77f3615ca0 100644 --- a/guides/source/initialization.md +++ b/guides/source/initialization.md @@ -558,7 +558,7 @@ The rest of `config/application.rb` defines the configuration for the initialized. When `config/application.rb` has finished loading Rails and defined the application namespace, we go back to `config/environment.rb`, where the application is initialized. For example, if the application was called -`Blog`, here we would find `Blog::Application.initialize!`, which is +`Blog`, here we would find `Rails.application.initialize!`, which is defined in `rails/application.rb` ### `railties/lib/rails/application.rb` diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md index 9c92cf3aea..b1b4c8fa4e 100644 --- a/guides/source/rails_on_rack.md +++ b/guides/source/rails_on_rack.md @@ -27,10 +27,9 @@ Rails on Rack ### Rails Application's Rack Object -`ApplicationName::Application` is the primary Rack application object of a Rails +`Rails.application` is the primary Rack application object of a Rails application. Any Rack compliant web server should be using -`ApplicationName::Application` object to serve a Rails -application. `Rails.application` refers to the same application object. +`Rails.application` object to serve a Rails application. ### `rails server` @@ -141,7 +140,7 @@ use ActionDispatch::ParamsParser use Rack::Head use Rack::ConditionalGet use Rack::ETag -run MyApp::Application.routes +run Rails.application.routes ``` The default middlewares shown here (and some others) are each summarized in the [Internal Middlewares](#internal-middleware-stack) section, below. @@ -201,7 +200,7 @@ use ActionDispatch::Static use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000001c304c8> use Rack::Runtime ... -run Blog::Application.routes +run Rails.application.routes ``` If you want to remove session related middleware, do the following: diff --git a/guides/source/routing.md b/guides/source/routing.md index 921658a71e..0783bce442 100644 --- a/guides/source/routing.md +++ b/guides/source/routing.md @@ -711,7 +711,7 @@ class BlacklistConstraint end end -TwitterClone::Application.routes.draw do +Rails.application.routes.draw do get '*path', to: 'blacklist#index', constraints: BlacklistConstraint.new end @@ -720,7 +720,7 @@ end You can also specify constraints as a lambda: ```ruby -TwitterClone::Application.routes.draw do +Rails.application.routes.draw do get '*path', to: 'blacklist#index', constraints: lambda { |request| Blacklist.retrieve_ips.include?(request.remote_ip) } end |