From bfd4adbcee398fd6472bb1ea96c86957074ad1bf Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Tue, 24 Nov 2020 19:20:30 +0000 Subject: [PATCH] Adapt code to work with frozen strings --- app/models/enterprise_group.rb | 10 ++++++---- lib/open_food_network/locking.rb | 2 ++ lib/open_food_network/permalink_generator.rb | 2 ++ spec/models/spree/product_spec.rb | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/models/enterprise_group.rb b/app/models/enterprise_group.rb index 5bb20d3821..b2bbfba198 100644 --- a/app/models/enterprise_group.rb +++ b/app/models/enterprise_group.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'open_food_network/locking' require 'open_food_network/permalink_generator' require 'spree/core/s3_support' @@ -66,10 +68,10 @@ class EnterpriseGroup < ActiveRecord::Base def unset_undefined_address_fields return if address.blank? - address.phone.sub!(/^#{I18n.t(:undefined)}$/, '') - address.address1.sub!(/^#{I18n.t(:undefined)}$/, '') - address.city.sub!(/^#{I18n.t(:undefined)}$/, '') - address.zipcode.sub!(/^#{I18n.t(:undefined)}$/, '') + address.phone = address.phone.sub(/^#{I18n.t(:undefined)}$/, '') + address.address1 = address.address1.sub(/^#{I18n.t(:undefined)}$/, '') + address.city = address.city.sub(/^#{I18n.t(:undefined)}$/, '') + address.zipcode = address.zipcode.sub(/^#{I18n.t(:undefined)}$/, '') end def to_param diff --git a/lib/open_food_network/locking.rb b/lib/open_food_network/locking.rb index 02bf2e1358..9e7b8cfd02 100644 --- a/lib/open_food_network/locking.rb +++ b/lib/open_food_network/locking.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module OpenFoodNetwork::Locking # http://rhnh.net/2010/06/30/acts-as-list-will-break-in-production def with_isolation_level_serializable diff --git a/lib/open_food_network/permalink_generator.rb b/lib/open_food_network/permalink_generator.rb index c86e6972de..4ac02f9e15 100644 --- a/lib/open_food_network/permalink_generator.rb +++ b/lib/open_food_network/permalink_generator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Finds a unique permalink for a new or updated record. # It considers soft-deleted records which are ignored by Spree. # Spree's work: diff --git a/spec/models/spree/product_spec.rb b/spec/models/spree/product_spec.rb index 8d6693c585..ee59d0c625 100644 --- a/spec/models/spree/product_spec.rb +++ b/spec/models/spree/product_spec.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +# frozen_string_literal: false require 'spec_helper' require 'spree/core/product_duplicator'