Why: * Once slug presence validation and usage is merged on to a code base, existing objects without it will become invalid and unusable How: * Running `bundle exec slugs:gnerate` will look for all models that include the concern, and generate a slug for each object
9 lines
277 B
Ruby
9 lines
277 B
Ruby
namespace :slugs do
|
|
desc "Generate slug attribute for objects from classes that use Sluggable concern"
|
|
task generate: :environment do
|
|
%w(Budget Budget::Heading Budget::Group).each do |class_name|
|
|
class_name.constantize.all.each(&:generate_slug)
|
|
end
|
|
end
|
|
end
|