diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2018-04-23 21:28:21 +0300 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2018-04-23 21:59:39 +0300 |
commit | d2fd01ec68f31bc6f2e5aee5344b3ad4a019df2d (patch) | |
tree | 8ee35b9bf465d806e473e8aaa2a65e0e02ad0de0 | |
parent | 80cbf19453bb3fe22e8d038a9631b8436320788b (diff) | |
download | rails-d2fd01ec68f31bc6f2e5aee5344b3ad4a019df2d.tar.gz rails-d2fd01ec68f31bc6f2e5aee5344b3ad4a019df2d.tar.bz2 rails-d2fd01ec68f31bc6f2e5aee5344b3ad4a019df2d.zip |
Fix title for example of removing data from `session` [ci skip]
After #31685 the description says different what
we expect to see in the example. Change `assign that key to be nil` to
`or delete the key/value pair` in order to highlight what is shown in the example.
Fix one more example of removing data from the session in favour of using
`delete` since assigning to `nil` doesn't delete key from it.
-rw-r--r-- | guides/source/action_controller_overview.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 4e3319dec4..cd685a228e 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -450,7 +450,7 @@ class LoginsController < ApplicationController end ``` -To remove something from the session, assign that key to be `nil`: +To remove something from the session, delete the key/value pair: ```ruby class LoginsController < ApplicationController @@ -478,7 +478,7 @@ Let's use the act of logging out as an example. The controller can send a messag ```ruby class LoginsController < ApplicationController def destroy - session[:current_user_id] = nil + session.delete(:current_user_id) flash[:notice] = "You have successfully logged out." redirect_to root_url end |