Sha256: 2283988d241bbacad85d3f5f390251a6b2a58d3bd2b38f8db2b2828989adb284

Contents?: true

Size: 409 Bytes

Versions: 3

Compression:

Stored size: 409 Bytes

Contents

Spree::Core::CurrentOrder.module_eval do
  # Associate the new order with the currently authenticated user before saving
  def before_save_new_order
    @current_order.user ||= try_spree_current_user
  end

  def after_save_new_order
    # make sure the user has permission to access the order (if they are a guest)
    return if spree_current_user
    session[:access_token] = @current_order.token
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_auth_devise-1.2.0 app/models/spree/current_order_decorator.rb
spree_auth_devise-1.0.1 app/models/spree/current_order_decorator.rb
spree_auth_devise-1.0.0 app/models/spree/current_order_decorator.rb