Sha256: b10fa5839563c51df0613d65f1668fda942984c7e8fae4e2b53d87ea743894db

Contents?: true

Size: 377 Bytes

Versions: 5

Compression:

Stored size: 377 Bytes

Contents

namespace :spree do
  desc "Resets all taxon permalinks"
  task :reset_taxon_peramlinks => :environment do
    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

5 entries across 5 versions & 1 rubygems

Version Path
spree_core-0.50.4 lib/tasks/taxon.rake
spree_core-0.50.3 lib/tasks/taxon.rake
spree_core-0.50.2 lib/tasks/taxon.rake
spree_core-0.50.1 lib/tasks/taxon.rake
spree_core-0.50.0 lib/tasks/taxon.rake