Add task to generate poll slugs
This commit is contained in:
8
lib/tasks/polls.rake
Normal file
8
lib/tasks/polls.rake
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace :poll do
|
||||
desc "Generate slugs polls"
|
||||
task generate_slugs: :environment do
|
||||
Poll.find_each do |poll|
|
||||
poll.update_columns(slug: poll.generate_slug, updated_at: Time.current) if poll.generate_slug?
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user