mailr/app/controllers/application_controller.rb

25 lines
398 B
Ruby
Raw Normal View History

2011-07-21 20:20:15 +02:00
require 'yaml'
2011-06-24 23:48:08 +02:00
2011-07-21 20:20:15 +02:00
class ApplicationController < ActionController::Base
2011-06-24 23:48:08 +02:00
2011-07-21 20:20:15 +02:00
protect_from_forgery
2011-06-24 23:48:08 +02:00
2011-07-21 20:20:15 +02:00
before_filter :load_defaults
before_filter :set_locale
2011-07-21 20:20:15 +02:00
protected
2009-09-01 14:23:05 +02:00
2011-07-21 20:20:15 +02:00
def load_defaults
@defaults = YAML::load(File.open(Rails.root.join('config','defaults.yml')))
end
2011-06-24 23:48:08 +02:00
2011-07-21 20:20:15 +02:00
def theme_resolver
@defaults['theme']
end
2009-09-01 14:23:05 +02:00
2011-07-21 20:20:15 +02:00
def set_locale
I18n.locale = @defaults['locale'] || I18n.default_locale
end
end