Sha256: c8e964502f4b71caad25d9dce252a8458f8de1116e910572e2e65602fa34ce53

Contents?: true

Size: 902 Bytes

Versions: 3

Compression:

Stored size: 902 Bytes

Contents

require 'spree_core'
require 'spree_api_hooks'

module SpreeApi
  class Engine < Rails::Engine
    def self.activate

      # RAILS3 TODO: Get the API stuff working with Devise
      # Spree::BaseController.class_eval do
      #   private
      #   def current_user
      #     return @current_user if defined?(@current_user)
      #     if current_user_session && current_user_session.user
      #       return @current_user = current_user_session.user
      #     end
      #     if token = request.headers['X-SpreeAPIKey']
      #       @current_user = User.find_by_api_key(token)
      #     end
      #   end
      # end
      
      Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
        Rails.env.production? ? require(c) : load(c)
      end

    end
    config.autoload_paths += %W(#{config.root}/lib)
    config.to_prepare &method(:activate).to_proc
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_api-0.30.2 lib/spree_api.rb
spree_api-0.30.1 lib/spree_api.rb
spree_api-0.30.0 lib/spree_api.rb