Sha256: 0428827342409ef3dbdfe85cb9a7fa1260dd4c8ec2075ca0716cb4181dcd0bb8

Contents?: true

Size: 378 Bytes

Versions: 43

Compression:

Stored size: 378 Bytes

Contents

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

43 entries across 43 versions & 1 rubygems

Version Path
solidus_frontend-2.5.2 lib/tasks/taxon.rake
solidus_frontend-2.5.1 lib/tasks/taxon.rake
solidus_frontend-2.5.0 lib/tasks/taxon.rake
solidus_frontend-2.5.0.rc1 lib/tasks/taxon.rake
solidus_frontend-2.5.0.beta2 lib/tasks/taxon.rake
solidus_frontend-2.5.0.beta1 lib/tasks/taxon.rake
solidus_frontend-2.4.2 lib/tasks/taxon.rake
solidus_frontend-2.2.2 lib/tasks/taxon.rake
solidus_frontend-2.4.1 lib/tasks/taxon.rake
solidus_frontend-2.3.1 lib/tasks/taxon.rake
solidus_frontend-2.1.1 lib/tasks/taxon.rake
solidus_frontend-2.0.3 lib/tasks/taxon.rake
solidus_frontend-1.4.2 lib/tasks/taxon.rake
solidus_frontend-1.3.2 lib/tasks/taxon.rake
solidus_frontend-2.4.0 lib/tasks/taxon.rake
solidus_frontend-2.4.0.rc1 lib/tasks/taxon.rake
solidus_frontend-2.4.0.beta1 lib/tasks/taxon.rake
solidus_frontend-2.3.0 lib/tasks/taxon.rake
solidus_frontend-2.3.0.rc3 lib/tasks/taxon.rake
solidus_frontend-2.3.0.rc2 lib/tasks/taxon.rake