Skip to content

Instantly share code, notes, and snippets.

@shushugah
Created July 24, 2014 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shushugah/f99c7bec4368012b4292 to your computer and use it in GitHub Desktop.
Save shushugah/f99c7bec4368012b4292 to your computer and use it in GitHub Desktop.
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rarequire File.expand_path('../config/application', __FILE__)
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks
task :text_each_alert => :environment do
Alert.all.each do |alert|
#if alert.relevant_time?
if (alert.last_alert_status != nil) && (alert.last_alert_status != alert.current_train_status)
text=TwilioWrapper.new(alert.id)
text.sms
alert.transmogrify
elsif alert.bad_service? && alert.last_alert_status != alert.current_train_status
text=TwilioWrapper.new(alert.id)
text.sms
alert.transmogrify
end
end
#end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment