Sha256: ad99628695d406f08e94f9c00a17063eb4ae5c6807d35e277ec9a4e295efab0f

Contents?: true

Size: 605 Bytes

Versions: 2

Compression:

Stored size: 605 Bytes

Contents

module Globalize2
  module GlobalizedFieldsControllerExtension
    def self.included base
      base.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

2 entries across 2 versions & 1 rubygems

Version Path
radiant-globalize2-extension-0.2.1 lib/globalize2/globalized_fields_controller_extension.rb
radiant-globalize2-extension-0.2.0 lib/globalize2/globalized_fields_controller_extension.rb