Sha256: ff40332fba87726ec514fd0dcd5aaa7a584e587bdba9912bd57c36b15e037465

Contents?: true

Size: 296 Bytes

Versions: 3

Compression:

Stored size: 296 Bytes

Contents

module ShoppingCart::CurrentSession
  extend ActiveSupport::Concern

  included do
    def current_order
      return @current_order ||= current_user.orders.in_progress.first if user_signed_in?

      @current_order ||= ShoppingCart::Order.find_by_id(cookies.signed[:order_id])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loker-shopping-cart-0.1.3 app/controllers/concerns/shopping_cart/current_session.rb
loker-shopping-cart-0.1.2 app/controllers/concerns/shopping_cart/current_session.rb
loker-shopping-cart-0.1.1 app/controllers/concerns/shopping_cart/current_session.rb