Skip to content

Commit 92a5d28

Browse files
Add clarifying comments to sessions_controller.rb
The sessions controller uses the standard method names, but it might not be obvious what they mean in the context of the sessions controller. This adds comments to clarify that. Signed-off-by: David A. Wheeler <[email protected]>
1 parent 10c7442 commit 92a5d28

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/controllers/sessions_controller.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class SessionsController < ApplicationController
1111
# because we don't really want the locale.
1212
skip_before_action :redir_missing_locale, only: :create
1313

14+
# Show login screen ("new" shows the page for trying to create a session)
1415
def new
1516
if logged_in?
1617
flash[:success] = t('sessions.already_logged_in')
@@ -21,6 +22,7 @@ def new
2122
end
2223
end
2324

25+
# Attempt to create a session. In other words, attempt to log in.
2426
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
2527
def create
2628
counter_fixation # Counter session fixation (but save forwarding url)
@@ -38,6 +40,7 @@ def create
3840
end
3941
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
4042

43+
# Log out
4144
def destroy
4245
log_out if logged_in?
4346
flash[:success] = t('sessions.signed_out')

0 commit comments

Comments
 (0)