Sha256: 44640d5a0b925257a75148bf9af3879ae961643c989f473b62e9eb99cadb3808

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

class RailsCart::BaseController < ApplicationController
  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  #protect_from_forgery :secret => '55a66755bef2c41d411bd5486c001b16'
  
  #include AuthenticatedSystem
  #include RoleRequirementSystem
  
  CalendarDateSelect.format = :american
  
  # unique cookie name to distinguish our session data from others'
  session :session_key => SESSION_KEY

  #model :order, :address
  
  filter_parameter_logging "password"
  
  def find_cart
    id = session[:cart_id]    
    unless id.blank?
      @cart = Cart.find_or_create_by_id(id)
    else
      @cart = Cart.create
      session[:cart_id] = @cart.id
    end
  end

  def access_denied
    if logged_in?
      access_forbidden
    else
      store_location
      redirect_to login_path
    end
    false  
  end

  def access_forbidden
    render :text => 'Access Forbidden', :layout => true, :status => 401
  end
  
  # Instantiates the selected PAYMENT_GATEWAY and initializes with GATEWAY_OPTIONS (configured in environment.rb)
  def payment_gateway
    ActiveMerchant::Billing::Base.gateway_mode = :test unless RAILS_ENV == "production"
    PAYMENT_GATEWAY.constantize.new(GATEWAY_OPTIONS)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree-0.0.5 starter-app/vendor/plugins/spree/app/controllers/rails_cart/base_controller.rb