Class: Athar::ThemesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/athar/themes_controller.rb

Constant Summary collapse

THEMES =
%w[dark light].freeze

Instance Method Summary collapse

Instance Method Details

#updateObject



7
8
9
10
11
12
13
14
# File 'app/controllers/athar/themes_controller.rb', line 7

def update
  theme = params[:theme].to_s

  return head :unprocessable_entity unless THEMES.include?(theme)

  cookies.permanent[:athar_theme] = { value: theme, same_site: :lax }
  head :no_content
end