Sha256: e1413465325c04db5d8035a829838193da2f29de9edad7ba1dc70d4ef057b633
Contents?: true
Size: 935 Bytes
Versions: 2
Compression:
Stored size: 935 Bytes
Contents
module IuguSDKBaseController def self.included(receiver) receiver.append_before_filter :configure_locale end def select_account set_account(current_user) if current_user end def configure_locale if(params[:hl]) locale = params[:hl] if AvailableLanguage.all.values.include? params[:hl] end unless locale @matched_locale_from_browser = request.preferred_language_from(AvailableLanguage.all.values) if signed_in? if current_user.locale.blank? locale = "en" else locale = current_user.locale end else locale = @matched_locale_from_browser end end I18n.locale = locale end def verify_api_key raise ActionController::RoutingError.new("iws_api_key missing") unless IuguSDK::iws_api_key end def locale_to_currency(locale) { 'pt-BR' => "BRL", 'en' => "USD" }[locale.to_s] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
iugusdk-1.0.0.alpha.9 | lib/iugusdk/iugusdk_base_controller.rb |
iugusdk-1.0.0.alpha.7 | lib/iugusdk/iugusdk_base_controller.rb |