diff --git a/core/app/models/spree/order.rb b/core/app/models/spree/order.rb index 4fd8fdd062a..b0eefa35966 100644 --- a/core/app/models/spree/order.rb +++ b/core/app/models/spree/order.rb @@ -742,6 +742,12 @@ def add_default_payment_from_wallet alias_method :assign_default_credit_card, :add_default_payment_from_wallet deprecate assign_default_credit_card: :add_default_payment_from_wallet, deprecator: Spree::Deprecation + def record_ip_address(ip_address) + if last_ip_address != ip_address + update_attributes!(last_ip_address: ip_address) + end + end + private def process_payments_before_complete diff --git a/core/lib/spree/core/controller_helpers/order.rb b/core/lib/spree/core/controller_helpers/order.rb index a96051a7d83..3f7fa10639e 100644 --- a/core/lib/spree/core/controller_helpers/order.rb +++ b/core/lib/spree/core/controller_helpers/order.rb @@ -45,7 +45,7 @@ def current_order(options = {}) end if @current_order - @current_order.update(last_ip_address: ip_address) + @current_order.record_ip_address(ip_address) return @current_order end end