Skip to content

Instantly share code, notes, and snippets.

@mattfitzgerald
Created February 20, 2012 02:11
Show Gist options
  • Save mattfitzgerald/1867256 to your computer and use it in GitHub Desktop.
Save mattfitzgerald/1867256 to your computer and use it in GitHub Desktop.
# find messages triggered as self generating delayed jobs that have no job and setup
AnniversaryMessage.find_all_by_enabled(true).select{|am| AnniversaryMessageSchedulerDelayedAction.currently_enqueued_for(am).empty?}.each{|m| m.setup_delayed_job}
BirthdayMessage.find_all_by_enabled(true).select{|bm| BirthdayMessageSchedulerDelayedAction.currently_enqueued_for(bm).empty?}.each{|m| m.setup_delayed_job}
AnnualPlannerMessage.find_all_by_enabled(true).select{|apm| AnniversaryMessageSchedulerDelayedAction.currently_enqueued_for(apm).empty?}.each{|m| m.setup_delayed_job}
OngoingCampaign.find_all_by_enabled(true).select{|om| OngoingMessageSchedulerDelayedAction.currently_enqueued_for(om).empty?}.each{|m| m.setup_delayed_job}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment