Sha256: 439c8333fefa535fe8d8a33e21914d6b7a5d5353ff63331676b2cd591a686c97

Contents?: true

Size: 409 Bytes

Versions: 98

Compression:

Stored size: 409 Bytes

Contents

# frozen_string_literal: true

namespace :spree do
  desc "Resets all taxon permalinks"
  task reset_taxon_permalinks: :environment do
    Spree::Taxon.where(parent_id: nil).each { |taxon| redo_permalinks(taxon) }
  end

  def redo_permalinks(taxon)
    taxon.permalink = nil
    puts "#{taxon.permalink} => #{taxon.set_permalink}"
    taxon.save

    taxon.children.each { |t| redo_permalinks(t) }
  end
end

Version data entries

98 entries across 98 versions & 2 rubygems

Version Path
solidus_frontend-4.0.0 lib/tasks/taxon.rake
solidus_frontend-4.0.0.dev lib/tasks/taxon.rake
solidus_frontend-3.4.0 lib/tasks/taxon.rake
solidus_frontend-3.1.9 lib/tasks/taxon.rake
solidus_frontend-3.4.0.dev lib/tasks/taxon.rake
solidus_frontend-3.3.0 lib/tasks/taxon.rake
solidus_frontend-3.2.5 lib/tasks/taxon.rake
solidus_frontend-3.2.4 lib/tasks/taxon.rake
solidus_frontend-3.2.3 lib/tasks/taxon.rake
solidus_frontend-3.1.8 lib/tasks/taxon.rake
solidus_frontend-3.0.8 lib/tasks/taxon.rake
solidus_frontend-3.2.2 lib/tasks/taxon.rake
solidus_frontend-3.2.1 lib/tasks/taxon.rake
solidus_frontend-3.3.0.alpha lib/tasks/taxon.rake
solidus_frontend-3.2.0 lib/tasks/taxon.rake
solidus_frontend-3.2.0.alpha lib/tasks/taxon.rake
solidus_frontend-3.0.7 lib/tasks/taxon.rake
solidus_frontend-2.11.17 lib/tasks/taxon.rake
solidus_frontend-3.1.7 lib/tasks/taxon.rake
solidus_frontend-2.11.16 lib/tasks/taxon.rake