Fix rubocop issues

This commit is contained in:
Luis Ramos
2020-08-06 11:12:49 +01:00
parent a1b64fe27b
commit 57e74a4980
2 changed files with 16 additions and 7 deletions

View File

@@ -11,10 +11,11 @@ module Spree
private
def dont_destroy_if_primary_taxon
if product.primary_taxon == taxon
errors.add :base, I18n.t(:spree_classification_primary_taxon_error, taxon: taxon.name, product: product.name)
false
end
return unless product.primary_taxon == taxon
errors.add :base, I18n.t(:spree_classification_primary_taxon_error, taxon: taxon.name,
product: product.name)
false
end
end
end

View File

@@ -41,9 +41,9 @@ module Spree
# Creates permalink based on Stringex's .to_url method
def set_permalink
if parent.present?
self.permalink = [parent.permalink, (permalink.blank? ? name.to_url : permalink.split('/').last)].join('/')
else
self.permalink = name.to_url if permalink.blank?
self.permalink = [parent.permalink, permalink_end].join('/')
elsif permalink.blank?
self.permalink = name.to_url
end
end
@@ -100,5 +100,13 @@ module Spree
ts[t.enterprise_id.to_i] << t.id
end
end
private
def permalink_end
return name.to_url if permalink.blank?
permalink.split('/').last
end
end
end