Module: Localite::Filter::ControllerFilter
- Defined in:
- lib/localite/filter.rb
Class Method Summary collapse
-
.filter(controller, &block) ⇒ Object
set up localite for this action.
Class Method Details
.filter(controller, &block) ⇒ Object
set up localite for this action.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/localite/filter.rb', line 5 def self.filter(controller, &block) args = controller.send(:localite_scopes) args.push :locale => controller.send(:current_locale), :format => controller.send(:localite_format) Localite.scope(*args) do if controller.logger && Rails.env.development? controller.logger.warn "localite: [#{Localite.current_locale}]" end yield end rescue if Rails.env.development? controller.response.body = "Caught exception: " + CGI::escapeHTML($!.inspect) end raise end |