agenda-libre-ruby/app/controllers/application_controller.rb

23 lines
634 B
Ruby
Raw Normal View History

# The top level controller, where can be centralised almost everything
2013-11-13 23:09:38 +01:00
class ApplicationController < ActionController::Base
before_action :set_paper_trail_whodunnit
2014-09-20 17:20:40 +02:00
before_action :set_locale
2013-11-13 23:09:38 +01:00
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
2014-09-20 17:20:40 +02:00
private
def set_locale
2015-11-10 23:29:05 +01:00
I18n.locale =
http_accept_language.compatible_language_from I18n.available_locales
2014-09-20 17:20:40 +02:00
end
protected
# Useful to manage absolute url in mails
def set_mailer_host
ActionMailer::Base.default_url_options[:host] = request.host_with_port
end
2013-11-13 23:09:38 +01:00
end