Skip to content

Commit

Permalink
Merge pull request spree#7366 from tommiller1/associate-user-when-cre…
Browse files Browse the repository at this point in the history
…ating-order

Adds call to associate_user when creating a new order through frontend
  • Loading branch information
damianlegawiec committed May 21, 2016
2 parents 0484dbe + d98c3e7 commit 4afc2bb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions core/lib/spree/core/controller_helpers/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ def current_order(options = {})
@current_order = find_order_by_token_or_user(options, true)

if options[:create_order_if_necessary] && (@current_order.nil? || @current_order.completed?)
@current_order = Spree::Order.new(current_order_params)
@current_order.user ||= try_spree_current_user
# See issue #3346 for reasons why this line is here
@current_order.created_by ||= try_spree_current_user
@current_order.save!
@current_order = Spree::Order.create!(current_order_params)
@current_order.associate_user! try_spree_current_user if try_spree_current_user
end

if @current_order
Expand Down

0 comments on commit 4afc2bb

Please sign in to comment.