Fix logical problem in spree/api/base_controller and in spree/checkout_controller

See this stack overflow post for more info: https://stackoverflow.com/questions/39629976/ruby-return-vs-and-return
This commit is contained in:
luisramos0
2019-07-18 19:06:39 +01:00
parent cf0f716534
commit 0e4fe08ac4
2 changed files with 7 additions and 7 deletions

View File

@@ -60,7 +60,7 @@ module Spree
!Spree::Api::Config[:requires_authentication]
return if api_key.present?
render "spree/api/errors/must_specify_api_key", status: :unauthorized && return
render("spree/api/errors/must_specify_api_key", status: :unauthorized) && return
end
def authenticate_user
@@ -68,7 +68,7 @@ module Spree
if requires_authentication? || api_key.present?
unless @current_api_user = Spree.user_class.find_by_spree_api_key(api_key.to_s)
render "spree/api/errors/invalid_api_key", status: :unauthorized && return
render("spree/api/errors/invalid_api_key", status: :unauthorized) && return
end
else
# An anonymous user
@@ -77,12 +77,12 @@ module Spree
end
def unauthorized
render "spree/api/errors/unauthorized", status: :unauthorized && return
render("spree/api/errors/unauthorized", status: :unauthorized) && return
end
def error_during_processing(exception)
render text: { exception: exception.message }.to_json,
status: :unprocessable_entity && return
render(text: { exception: exception.message }.to_json,
status: :unprocessable_entity) && return
end
def requires_authentication?
@@ -90,7 +90,7 @@ module Spree
end
def not_found
render "spree/api/errors/not_found", status: :not_foun && return
render("spree/api/errors/not_found", status: :not_found) && return
end
def current_ability

View File

@@ -29,7 +29,7 @@ module Spree
def load_order
@order = current_order
redirect_to main_app.cart_path && return unless @order
redirect_to(main_app.cart_path) && return unless @order
if params[:state]
redirect_to checkout_state_path(@order.state) if @order.can_go_to_state?(params[:state])