From d2fd01ec68f31bc6f2e5aee5344b3ad4a019df2d Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Mon, 23 Apr 2018 21:28:21 +0300 Subject: 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. --- guides/source/action_controller_overview.md | 4 ++-- 1 file 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 -- cgit v1.2.3