Sha256: ba56669437799c209c6a1fbd7e980437663f7234309ebdcedddadfc758588e04

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 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
    @cart = (session[:cart] ||= Cart.new)
  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

4 entries across 4 versions & 1 rubygems

Version Path
railscart-0.0.1 starter-app/vendor/plugins/railscart/app/controllers/rails_cart/base_controller.rb
railscart-0.0.2 starter_app/vendor/plugins/railscart/app/controllers/rails_cart/base_controller.rb
railscart-0.0.3 starter_app/vendor/plugins/railscart/app/controllers/rails_cart/base_controller.rb
railscart-0.0.4 starter_app/vendor/plugins/railscart/app/controllers/rails_cart/base_controller.rb