Sha256: 4abc19b830a96c437eeea423fc6195482235433143e6b80875c10e4a251cd03e

Contents?: true

Size: 993 Bytes

Versions: 6

Compression:

Stored size: 993 Bytes

Contents

module Locomotive
  module Api
    class BaseController < ApplicationController

      include Locomotive::Routing::SiteDispatcher
      include Locomotive::ActionController::LocaleHelpers

      skip_before_filter :verify_authenticity_token

      skip_load_and_authorize_resource

      before_filter :require_account

      before_filter :require_site

      before_filter :set_locale

      # before_filter :validate_site_membership

      self.responder = Locomotive::ActionController::Responder # custom responder

      respond_to :json, :xml

      protected

      def current_ability
        @current_ability ||= Ability.new(current_locomotive_account, current_site)
      end

      def require_account
        authenticate_locomotive_account!
      end

      def set_locale
        ::Mongoid::Fields::I18n.locale = params[:locale] || current_site.default_locale
        ::I18n.locale = ::Mongoid::Fields::I18n.locale

        self.setup_i18n_fallbacks
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc7 app/controllers/locomotive/api/base_controller.rb
locomotive_cms-2.0.0.rc6 app/controllers/locomotive/api/base_controller.rb
locomotive_cms-2.0.0.rc5 app/controllers/locomotive/api/base_controller.rb
locomotive_cms-2.0.0.rc4 app/controllers/locomotive/api/base_controller.rb
locomotive_cms-2.0.0.rc2 app/controllers/locomotive/api/base_controller.rb
locomotive_cms-2.0.0.rc1 app/controllers/locomotive/api/base_controller.rb