invoice_keeper/app/controllers/application_controller.rb

22 lines
443 B
Ruby

class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :authenticate_user!
before_action :set_locale
layout :layout_by_resource
def set_locale
I18n.locale = params[:lang] || I18n.default_locale
end
protected
def layout_by_resource
if devise_controller? && resource_name == :user && action_name == "new"
"devise"
else
"application"
end
end
end