mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
Fix rubocop issues
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user