Add controller concern to initialize Globalize fallbacks
Ensure to initialize all requests including this concern into all application base controllers.
This commit is contained in:
committed by
voodoorai2000
parent
0011a0b4c7
commit
8c2f1b894d
@@ -1,6 +1,7 @@
|
|||||||
require "application_responder"
|
require "application_responder"
|
||||||
|
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
|
include GlobalizeFallbacks
|
||||||
include HasFilters
|
include HasFilters
|
||||||
include HasOrders
|
include HasOrders
|
||||||
include AccessDeniedHandler
|
include AccessDeniedHandler
|
||||||
@@ -14,7 +15,6 @@ class ApplicationController < ActionController::Base
|
|||||||
before_action :track_email_campaign
|
before_action :track_email_campaign
|
||||||
before_action :set_return_url
|
before_action :set_return_url
|
||||||
before_action :set_current_user
|
before_action :set_current_user
|
||||||
before_action :set_fallbacks_to_all_available_locales
|
|
||||||
|
|
||||||
check_authorization unless: :devise_controller?
|
check_authorization unless: :devise_controller?
|
||||||
self.responder = ApplicationResponder
|
self.responder = ApplicationResponder
|
||||||
@@ -124,8 +124,4 @@ class ApplicationController < ActionController::Base
|
|||||||
def set_current_user
|
def set_current_user
|
||||||
User.current_user = current_user
|
User.current_user = current_user
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_fallbacks_to_all_available_locales
|
|
||||||
Globalize.set_fallbacks_to_all_available_locales
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
13
app/controllers/concerns/globalize_fallbacks.rb
Normal file
13
app/controllers/concerns/globalize_fallbacks.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
module GlobalizeFallbacks
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
before_action :initialize_globalize_fallbacks
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def initialize_globalize_fallbacks
|
||||||
|
Globalize.set_fallbacks_to_all_available_locales
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
class Management::BaseController < ActionController::Base
|
class Management::BaseController < ActionController::Base
|
||||||
|
include GlobalizeFallbacks
|
||||||
layout "management"
|
layout "management"
|
||||||
|
|
||||||
before_action :verify_manager
|
before_action :verify_manager
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
require "manager_authenticator"
|
require "manager_authenticator"
|
||||||
|
|
||||||
class Management::SessionsController < ActionController::Base
|
class Management::SessionsController < ActionController::Base
|
||||||
|
include GlobalizeFallbacks
|
||||||
include AccessDeniedHandler
|
include AccessDeniedHandler
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|||||||
Reference in New Issue
Block a user