Sha256: 244af501998783295c1ca4907ef3a1a5fea9ed9c42434e3b2e0266dad227198e

Contents?: true

Size: 482 Bytes

Versions: 2

Compression:

Stored size: 482 Bytes

Contents

namespace :seo_friendly do

  desc 'Regenerate seo params for chosen model'
  task :regenerate, [:model_name] => :environment do |t, args|

    unless args[:model_name]
      abort('WARNING! Set model name parametr to execute this rake task')
    end

    model = args[:model_name].capitalize.constantize

    model.find_each do |instance|

      instance.update_seo_attributes
      puts "Update seo attributes for #{instance.class.name} with ID #{instance.id}"
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
seo_friendly-0.0.2 lib/tasks/rebuild_seo_params.rake
seo_friendly-0.0.1 lib/tasks/rebuild_seo_params.rake