Sha256: 2315d6103a0f04b352d19d9a89de94b72e7a7bce1a7ff8bcb47c75ee6c75077a

Contents?: true

Size: 885 Bytes

Versions: 19

Compression:

Stored size: 885 Bytes

Contents

module Shop
  module Controllers
    module ApplicationController
      
      def self.included(base)
        base.class_eval do
          filter_parameter_logging :password, :password_confirmation, :credit
          
          def current_shop_order
            find_or_create_shop_order
          end
          
          def find_shop_order
            ShopOrder.find_by_session(request.session[:shop_order])
          end
          
          def find_or_create_shop_order
            begin
              @order = find_shop_order
            rescue
              @order = ShopOrder.create
              request.session[:shop_order] = @order.id
            end
            
            if current_user
              @order.update_attribute(:customer_id, (current_user.id))
            end
            
            @order
          end
        end
      end
      
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
radiant-shop-extension-0.94.8 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.94.7 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.94.6 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.94.5 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.94.4 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.94.3 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.94.2 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.94.1 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.94.0 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.93.3 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.93.2 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.93.1 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.93.0 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.92.11 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.92.10 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.92.9 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.92.8 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.92.7 lib/shop/controllers/application_controller.rb
radiant-shop-extension-0.92.6 lib/shop/controllers/application_controller.rb