From 43ab0158fbcafb13fa25d3a06dd53f7b7a92f196 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 14:02:56 -0600 Subject: Document introduction of the ActionController::UnknownFormat exception --- guides/source/upgrading_ruby_on_rails.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 52f5232efc..d378d51c2a 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -101,6 +101,8 @@ Also check your environment settings for `config.action_dispatch.best_standards_ * In Rails 4.0, precompiling assets no longer automatically copies non-JS/CSS assets from `vendor/assets` and `lib/assets`. Rails application and engine developers should put these assets in `app/assets` or configure `config.assets.precompile`. +* In Rails 4.0, a rescuable exception `ActionController::UnknownFormat` is raised when Rails doesn't know what to do with the request format, rather than responding with a head :not_acceptable (406). + ### Active Support Rails 4.0 removes the `j` alias for `ERB::Util#json_escape` since `j` is already used for `ActionView::Helpers::JavaScriptHelper#escape_javascript`. -- cgit v1.2.3 From 27a304d8e093062723552df056295e59c9993f4b Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 14:06:15 -0600 Subject: Document extraction of actionpack-xml_parser --- guides/source/upgrading_ruby_on_rails.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index d378d51c2a..47b246fe76 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -74,6 +74,8 @@ Rails 4.0 extracted Active Resource to its own gem. If you still need the featur * Rails 4.0 has removed Action and Page caching from Action Pack. You will need to add the `actionpack-action_caching` gem in order to use `caches_action` and the `actionpack-page_caching` to use `caches_pages` in your controllers. +* Rails 4.0 has the removed XML parameters parser. You will need to add the `actionpack-xml_parser` gem if you require this feature. + * Rails 4.0 changed how `assert_generates`, `assert_recognizes`, and `assert_routing` work. Now all these assertions raise `Assertion` instead of `ActionController::RoutingError`. * Rails 4.0 also changed the way unicode character routes are drawn. Now you can draw unicode character routes directly. If you already draw such routes, you must change them, for example: -- cgit v1.2.3 From decff78d013db0d07331f2d405d85a3f10185a02 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 14:16:36 -0600 Subject: Improve docs for UpgradeSignatureToEncryptionCookieStore --- guides/source/upgrading_ruby_on_rails.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 47b246fe76..8e9d9de446 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -66,7 +66,16 @@ Rails 4.0 extracted Active Resource to its own gem. If you still need the featur ### Action Pack -* There is an upgrading cookie store `UpgradeSignatureToEncryptionCookieStore` which helps you upgrading apps that use `CookieStore` to the new default `EncryptedCookieStore`. To use this `CookieStore` set `Myapp::Application.config.session_store :upgrade_signature_to_encryption_cookie_store, key: '_myapp_session'` in `config/initializers/session_store.rb`. Additionally, add `Myapp::Application.config.secret_key_base = 'some secret'` in `config/initializers/secret_token.rb`. Do not remove `Myapp::Application.config.secret_token = 'some secret'`. +* Rails 4.0 introduces a new `UpgradeSignatureToEncryptionCookieStore` cookie store. This is useful for upgrading apps using the old default `CookieStore` to the new default `EncryptedCookieStore`. To use this transitional cookie store, you'll want to leave your existing `secret_token` in place, add a new `secret_key_base`, and change your `session_store` like so: + +```ruby + # config/initializers/session_store.rb + Myapp::Application.config.session_store :upgrade_signature_to_encryption_cookie_store, key: 'existing session key' + + # config/initializers/secret_token.rb + Myapp::Application.config.secret_token = 'existing secret token' + Myapp::Application.config.secret_key_base = 'new secret key base' +``` * Rails 4.0 removed the `ActionController::Base.asset_path` option. Use the assets pipeline feature. -- cgit v1.2.3 From 3dd5444e56e009276d24a49f451e860daeafd613 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 14:17:47 -0600 Subject: Document the switch from memcache-client to dalli --- guides/source/upgrading_ruby_on_rails.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 8e9d9de446..1e82261b73 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -85,6 +85,8 @@ Rails 4.0 extracted Active Resource to its own gem. If you still need the featur * Rails 4.0 has the removed XML parameters parser. You will need to add the `actionpack-xml_parser` gem if you require this feature. +* Rails 4.0 changes the default memcached client from `memcache-client` to `dalli`. To upgrade, simply add `gem 'dalli'` to your `Gemfile`. + * Rails 4.0 changed how `assert_generates`, `assert_recognizes`, and `assert_routing` work. Now all these assertions raise `Assertion` instead of `ActionController::RoutingError`. * Rails 4.0 also changed the way unicode character routes are drawn. Now you can draw unicode character routes directly. If you already draw such routes, you must change them, for example: -- cgit v1.2.3 From 1525268d1ec74cdc34559907ddfb5b1cc6c30029 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 14:25:07 -0600 Subject: Document rails-observers extraction --- guides/source/upgrading_ruby_on_rails.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 1e82261b73..2e1f7118e1 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -124,6 +124,10 @@ Rails 4.0 removes the `j` alias for `ERB::Util#json_escape` since `j` is already The order in which helpers from more than one directory are loaded has changed in Rails 4.0. Previously, they were gathered and then sorted alphabetically. After upgrading to Rails 4.0, helpers will preserve the order of loaded directories and will be sorted alphabetically only within each directory. Unless you explicitly use the `helpers_path` parameter, this change will only impact the way of loading helpers from engines. If you rely on the ordering, you should check if correct methods are available after upgrade. If you would like to change the order in which engines are loaded, you can use `config.railties_order=` method. +### Active Record Observer and Action Controller Sweeper + +Active Record Observer and Action Controller Sweeper have been extracted to the `rails-observers` gem. You will need to add the `rails-observers` gem if you require these features. + Upgrading from Rails 3.1 to Rails 3.2 ------------------------------------- -- cgit v1.2.3 From 8ecc2edcd0b9ff3e03c427fdbdeb329d4e65ac60 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 15:19:54 -0600 Subject: Document caveat from 5b3bb61 which fixed handling SCRIPT_NAME from within mounted engine --- guides/source/upgrading_ruby_on_rails.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 2e1f7118e1..950290d106 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -116,6 +116,9 @@ Also check your environment settings for `config.action_dispatch.best_standards_ * In Rails 4.0, a rescuable exception `ActionController::UnknownFormat` is raised when Rails doesn't know what to do with the request format, rather than responding with a head :not_acceptable (406). +* In Rails 4.0, `SCRIPT_NAME` is properly handled for mounted apps and engines. One caveat of the fix is that you should *not* set +`default_url_options[:script_name]` explicitly if your server already passes correct `SCRIPT_NAME` to rack env. + ### Active Support Rails 4.0 removes the `j` alias for `ERB::Util#json_escape` since `j` is already used for `ActionView::Helpers::JavaScriptHelper#escape_javascript`. -- cgit v1.2.3 From cfb04a69a1a6f61861d33154250b6fb9b28a5848 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 15:29:05 -0600 Subject: Document sass-rails asset_url deprecation --- guides/source/upgrading_ruby_on_rails.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 950290d106..eff00f7276 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -131,6 +131,10 @@ The order in which helpers from more than one directory are loaded has changed i Active Record Observer and Action Controller Sweeper have been extracted to the `rails-observers` gem. You will need to add the `rails-observers` gem if you require these features. +### sass-rails + +* `asset_url` with two arguments is deprecated. For example: `asset-url("rails.png", image)` becomes `asset-url("rails.png")` + Upgrading from Rails 3.1 to Rails 3.2 ------------------------------------- -- cgit v1.2.3 From 97d9843ef562e7ba9de9e5db5a7ff63bec1f53a7 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 15:34:38 -0600 Subject: Document removal of assets:precompile:primary --- guides/source/upgrading_ruby_on_rails.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index eff00f7276..4eb5eff40f 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -131,6 +131,10 @@ The order in which helpers from more than one directory are loaded has changed i Active Record Observer and Action Controller Sweeper have been extracted to the `rails-observers` gem. You will need to add the `rails-observers` gem if you require these features. +### sprockets-rails + +* `assets:precompile:primary` has been removed. Use `assets:precompile` instead. + ### sass-rails * `asset_url` with two arguments is deprecated. For example: `asset-url("rails.png", image)` becomes `asset-url("rails.png")` -- cgit v1.2.3 From 74d471a4aaa4b6e7e8d51ff6c68ce158a06e5e58 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 15:40:25 -0600 Subject: Document change in routes using match --- guides/source/upgrading_ruby_on_rails.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 4eb5eff40f..e7459ff77b 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -101,6 +101,19 @@ becomes get 'こんにちは', controller: 'welcome', action: 'index' ``` +* Rails 4.0 requires routes using `match` must specify the request method. For example: + +```ruby + # Rails 3.x + match "/" => "root#index" + + # becomes + match "/" => "root#index", via: :get + + # or + get "/" => "root#index" +``` + * Rails 4.0 has removed ActionDispatch::BestStandardsSupport middleware, !DOCTYPE html already triggers standards mode per http://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx and ChromeFrame header has been moved to `config.action_dispatch.default_headers` Remember you must also remove any references to the middleware from your application code, for example: -- cgit v1.2.3 From a1d8b031d355fdbf9e93d26e33dfdac247c8a5f9 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 15:41:20 -0600 Subject: Document ActiveRecord::Fixtures becoming ActiveRecord::FixtureSet --- guides/source/upgrading_ruby_on_rails.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index e7459ff77b..b620f517db 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -47,6 +47,8 @@ Rails 4.0 no longer supports loading plugins from `vendor/plugins`. You must rep * Rails 4.0 has removed `attr_accessible` and `attr_protected` feature in favor of Strong Parameters. You can use the [Protected Attributes gem](https://github.com/rails/protected_attributes) to a smoothly upgrade path. +* Rails 4.0 has deprecated `ActiveRecord::Fixtures` in favor of `ActiveRecord::FixtureSet`. + ### Active Resource Rails 4.0 extracted Active Resource to its own gem. If you still need the feature you can add the [Active Resource gem](https://github.com/rails/activeresource) in your Gemfile. -- cgit v1.2.3 From 0407ef5eaf965a69a8854370537f41d6da5b5060 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 15:45:37 -0600 Subject: Document the deprecation of ActionView::RecordIdentifier --- guides/source/upgrading_ruby_on_rails.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index b620f517db..b6f49c28b9 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -89,6 +89,8 @@ Rails 4.0 extracted Active Resource to its own gem. If you still need the featur * Rails 4.0 changes the default memcached client from `memcache-client` to `dalli`. To upgrade, simply add `gem 'dalli'` to your `Gemfile`. +* Rails 4.0 deprecates the `dom_id` and `dom_class` methods. You will need to include the `ActionView::RecordIdentifier` module in controllers requiring this feature. + * Rails 4.0 changed how `assert_generates`, `assert_recognizes`, and `assert_routing` work. Now all these assertions raise `Assertion` instead of `ActionController::RoutingError`. * Rails 4.0 also changed the way unicode character routes are drawn. Now you can draw unicode character routes directly. If you already draw such routes, you must change them, for example: -- cgit v1.2.3 From 51876271e2d1aaf50f7b1d31db06132ec5827e95 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 15:50:28 -0600 Subject: Document common deprecations --- guides/source/upgrading_ruby_on_rails.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index b6f49c28b9..dc0bc5bea1 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -49,6 +49,8 @@ Rails 4.0 no longer supports loading plugins from `vendor/plugins`. You must rep * Rails 4.0 has deprecated `ActiveRecord::Fixtures` in favor of `ActiveRecord::FixtureSet`. +* Rails 4.0 has deprecated `ActiveRecord::TestCase` in favor of `ActiveSupport::TestCase`. + ### Active Resource Rails 4.0 extracted Active Resource to its own gem. If you still need the feature you can add the [Active Resource gem](https://github.com/rails/activeresource) in your Gemfile. @@ -136,6 +138,15 @@ Also check your environment settings for `config.action_dispatch.best_standards_ * In Rails 4.0, `SCRIPT_NAME` is properly handled for mounted apps and engines. One caveat of the fix is that you should *not* set `default_url_options[:script_name]` explicitly if your server already passes correct `SCRIPT_NAME` to rack env. +* Rails 4.0 deprecated `ActionController::Integration` in favor of `ActionDispatch::Integration`. +* Rails 4.0 deprecated `ActionController::IntegrationTest` in favor of `ActionDispatch::IntegrationTest`. +* Rails 4.0 deprecated `ActionController::PerformanceTest` in favor of `ActionDispatch::PerformanceTest`. +* Rails 4.0 deprecated `ActionController::AbstractRequest` in favor of `ActionDispatch::Request`. +* Rails 4.0 deprecated `ActionController::Request` in favor of `ActionDispatch::Request`. +* Rails 4.0 deprecated `ActionController::AbstractResponse` in favor of `ActionDispatch::Response`. +* Rails 4.0 deprecated `ActionController::Response` in favor of `ActionDispatch::Response`. +* Rails 4.0 deprecated `ActionController::Routing` in favor of `ActionDispatch::Routing`. + ### Active Support Rails 4.0 removes the `j` alias for `ERB::Util#json_escape` since `j` is already used for `ActionView::Helpers::JavaScriptHelper#escape_javascript`. -- cgit v1.2.3 From 5b8b9771d7c8b45eb9f0c0ca640420eb91b8f037 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 15:53:24 -0600 Subject: Document that scopes require a callable object --- guides/source/upgrading_ruby_on_rails.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index dc0bc5bea1..77a09cd5f0 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -47,8 +47,16 @@ Rails 4.0 no longer supports loading plugins from `vendor/plugins`. You must rep * Rails 4.0 has removed `attr_accessible` and `attr_protected` feature in favor of Strong Parameters. You can use the [Protected Attributes gem](https://github.com/rails/protected_attributes) to a smoothly upgrade path. -* Rails 4.0 has deprecated `ActiveRecord::Fixtures` in favor of `ActiveRecord::FixtureSet`. +* Rails 4.0 requires that scopes use a callable object such as a Proc or lambda: + +```ruby + scope :active, where(active: true) + # becomes + scope :active, -> { where active: true } +``` + +* Rails 4.0 has deprecated `ActiveRecord::Fixtures` in favor of `ActiveRecord::FixtureSet`. * Rails 4.0 has deprecated `ActiveRecord::TestCase` in favor of `ActiveSupport::TestCase`. ### Active Resource -- cgit v1.2.3 From 7874c9be8393bacf060d2df7af468fa3b83d9f27 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Thu, 28 Feb 2013 15:55:27 -0600 Subject: Document introduction of ActionDispatch::ParamsParser::ParseError --- guides/source/upgrading_ruby_on_rails.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 77a09cd5f0..9581cb5c21 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -143,6 +143,8 @@ Also check your environment settings for `config.action_dispatch.best_standards_ * In Rails 4.0, a rescuable exception `ActionController::UnknownFormat` is raised when Rails doesn't know what to do with the request format, rather than responding with a head :not_acceptable (406). +* In Rails 4.0 a generic rescuable exception `ActionDispatch::ParamsParser::ParseError` is raised when `ParamsParser` fails parsing request params. You will want to rescue from this generic exception instead of `MultiJson::DecodeError`, for example. + * In Rails 4.0, `SCRIPT_NAME` is properly handled for mounted apps and engines. One caveat of the fix is that you should *not* set `default_url_options[:script_name]` explicitly if your server already passes correct `SCRIPT_NAME` to rack env. -- cgit v1.2.3