Sha256: 8d56847eec3d7b5f5253b36cc3302b3342bf76c409d3b700bc33ffd5bd111824

Contents?: true

Size: 613 Bytes

Versions: 6

Compression:

Stored size: 613 Bytes

Contents

module Globalize2
  module GlobalizedFieldsControllerExtension
    def self.included base
      base.prepend_before_filter :set_content_locale
    end


    def update
      I18n.with_locale(Globalize2Extension.content_locale) do
        model.update_attributes!(params[model_symbol])
      end
      
      response_for :update
    end

    private
    def set_content_locale
      Globalize2Extension.content_locale = params[:content_locale] || session[:content_locale] || Globalize2Extension.default_language
      session[:content_locale] = params[:content_locale] if params[:content_locale]
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
radiant-globalize2-extension-0.2.7 lib/globalize2/globalized_fields_controller_extension.rb
radiant-globalize2-extension-0.2.6 lib/globalize2/globalized_fields_controller_extension.rb
radiant-globalize2-extension-0.2.5 lib/globalize2/globalized_fields_controller_extension.rb
radiant-globalize2-extension-0.2.4 lib/globalize2/globalized_fields_controller_extension.rb
radiant-globalize2-extension-0.2.3 lib/globalize2/globalized_fields_controller_extension.rb
radiant-globalize2-extension-0.2.2 lib/globalize2/globalized_fields_controller_extension.rb