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-2.6.2 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.14 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.13 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.12 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.11 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.10 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.9 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.8 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.7 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.6 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.5 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.4 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.3 lib/tasks/taxon.rake
solidus_frontend_devise_token_auth-2.8.0.alpha.2 lib/tasks/taxon.rake
solidus_frontend-2.7.0 lib/tasks/taxon.rake
solidus_frontend-2.6.1 lib/tasks/taxon.rake
solidus_frontend-2.6.0 lib/tasks/taxon.rake
solidus_frontend-2.6.0.rc1 lib/tasks/taxon.rake