aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/4_1_release_notes.md
diff options
context:
space:
mode:
Diffstat (limited to 'guides/source/4_1_release_notes.md')
-rw-r--r--guides/source/4_1_release_notes.md102
1 files changed, 56 insertions, 46 deletions
diff --git a/guides/source/4_1_release_notes.md b/guides/source/4_1_release_notes.md
index 2c01970f63..5f1ecb1cae 100644
--- a/guides/source/4_1_release_notes.md
+++ b/guides/source/4_1_release_notes.md
@@ -30,7 +30,7 @@ guide.
Major Features
--------------
-### Spring application preloader
+### Spring Application Preloader
Spring is a Rails application preloader. It speeds up development by keeping
your application running in the background so you don't need to boot it every
@@ -40,27 +40,19 @@ New Rails 4.1 applications will ship with "springified" binstubs. This means
that `bin/rails` and `bin/rake` will automatically take advantage of preloaded
spring environments.
-**running rake tasks:**
+**Running rake tasks:**
```
-bin/rake routes
+bin/rake test:models
```
-**running tests:**
-
-```
-bin/rake test
-bin/rake test test/models
-bin/rake test test/models/user_test.rb
-```
-
-**running a console:**
+**Running a Rails command:**
```
bin/rails console
```
-**spring introspection:**
+**Spring introspection:**
```
$ bin/spring status
@@ -80,13 +72,12 @@ guide on how to migrate existing applications to use this feature.
### `config/secrets.yml`
-Rails 4.1 will generate a new `secrets.yml` file in the `config` folder for new
-applications. By default, this file contains the application's `secret_key_base`,
-but it could also be used to store other secrets such as access keys for external
-APIs.
+Rails 4.1 generates a new `secrets.yml` file in the `config` folder. By default,
+this file contains the application's `secret_key_base`, but it could also be
+used to store other secrets such as access keys for external APIs.
-The secrets added to this file will be accessible via `Rails.application.secrets`.
-For example, with the following `secrets.yml`:
+The secrets added to this file are accessible via `Rails.application.secrets`.
+For example, with the following `config/secrets.yml`:
```yaml
development:
@@ -94,16 +85,16 @@ development:
some_api_key: SOMEKEY
```
-`Rails.application.secrets.some_api_key` will return `SOMEKEY` in the development
+`Rails.application.secrets.some_api_key` returns `SOMEKEY` in the development
environment.
See the [Upgrading Ruby on Rails](upgrading_ruby_on_rails.html#config-secrets-yml)
guide on how to migrate existing applications to use this feature.
-### Action Pack variants
+### Action Pack Variants
-We often want to render different html/json/xml templates for phones,
-tablets, and desktop browsers. Variants makes it easy.
+We often want to render different HTML/JSON/XML templates for phones,
+tablets, and desktop browsers. Variants make it easy.
The request variant is a specialization of the request format, like `:tablet`,
`:phone`, or `:desktop`.
@@ -143,24 +134,30 @@ respond_to do |format|
end
```
-### Action Mailer previews
+### Action Mailer Previews
+
+Action Mailer previews provide a way to visually see how emails look by visiting
+a special URL that renders them.
-Preview email templates in the browser without delivering them.
+You implement a preview class whose methods return the mail object you'd like
+to check:
```ruby
class NotifierPreview < ActionMailer::Preview
- # Accessible from http://localhost:3000/rails/mailers/notifier/welcome
def welcome
Notifier.welcome(User.first)
end
end
```
-By default, these preview files live in <tt>test/mailers/previews</tt>.
-This can be configured using the <tt>preview_path</tt> option.
+The preview is available in http://localhost:3000/rails/mailers/notifier/welcome,
+and a list of them in http://localhost:3000/rails/mailers.
-See
-[action_mailer/base.rb](api.rubyonrails.org/v4.1.0/classes/ActionMailer/Base.html)
+By default, these preview classes live in `test/mailers/previews`.
+This can be configured using the `preview_path` option.
+
+See its
+[documentation](http://api.rubyonrails.org/v4.1.0/classes/ActionMailer/Base.html)
for a detailed write up.
### Active Record enums
@@ -180,19 +177,26 @@ conversation.status # => "archived"
Conversation.archived # => Relation for all archived Conversations
```
-See
-[active_record/enum.rb](api.rubyonrails.org/v4.1.0/classes/ActiveRecord/Enum.html)
+See its
+[documentation](http://api.rubyonrails.org/v4.1.0/classes/ActiveRecord/Enum.html)
for a detailed write up.
-### Application message verifier
+### Message Verifiers
+
+Message verifiers can be used to generate and verify signed messages. This can
+be useful to safely transport sensitive data like remember-me tokens and
+friends.
-Create a message verifier that can be used to generate and verify signed
-messages in the application.
+The method `Rails.application.message_verifier` returns a new message verifier
+that signs messages with a key derived from secret_key_base and the given
+message verifier name:
```ruby
-message = Rails.application.message_verifier('salt').generate('my sensible data')
-Rails.application.message_verifier('salt').verify(message)
-# => 'my sensible data'
+signed_token = Rails.application.message_verifier(:remember_me).generate(token)
+Rails.application.message_verifier(:remember_me).verify(signed_token) # => token
+
+Rails.application.message_verifier(:remember_me).verify(tampered_token)
+# raises ActiveSupport::MessageVerifier::InvalidSignature
```
### Module#concerning
@@ -222,6 +226,10 @@ This example is equivalent to defining a `EventTracking` module inline,
extending it with `ActiveSupport::Concern`, then mixing it in to the
`Todo` class.
+See its
+[documentation](http://api.rubyonrails.org/v4.1.0/classes/Module/Concerning.html)
+for a detailed write up and the intended use cases.
+
### CSRF protection from remote `<script>` tags
Cross-site request forgery (CSRF) protection now covers GET requests with
@@ -292,13 +300,15 @@ for detailed changes.
* Removed deprecated constants from Action Controller:
- ActionController::AbstractRequest => ActionDispatch::Request
- ActionController::Request => ActionDispatch::Request
- ActionController::AbstractResponse => ActionDispatch::Response
- ActionController::Response => ActionDispatch::Response
- ActionController::Routing => ActionDispatch::Routing
- ActionController::Integration => ActionDispatch::Integration
- ActionController::IntegrationTest => ActionDispatch::IntegrationTest
+ | Removed | Successor |
+ |:-----------------------------------|:--------------------------------|
+ | ActionController::AbstractRequest | ActionDispatch::Request |
+ | ActionController::Request | ActionDispatch::Request |
+ | ActionController::AbstractResponse | ActionDispatch::Response |
+ | ActionController::Response | ActionDispatch::Response |
+ | ActionController::Routing | ActionDispatch::Routing |
+ | ActionController::Integration | ActionDispatch::Integration |
+ | ActionController::IntegrationTest | ActionDispatch::IntegrationTest |
### Notable changes
@@ -516,7 +526,7 @@ for detailed changes.
* Removed deprecated `Module#local_constant_names` in favor of `Module#local_constants`.
-* Removed deprecated `DateTime.local_offset` in favor of `DateTime.civil_from_fromat`.
+* Removed deprecated `DateTime.local_offset` in favor of `DateTime.civil_from_format`.
* Removed deprecated `Logger` core extensions (`core_ext/logger.rb`).