Sha256: 632421532e43bb7da9f3e2c09fb0061e8d25e39239afeefd164e669ca4008d51

Contents?: true

Size: 746 Bytes

Versions: 9

Compression:

Stored size: 746 Bytes

Contents

# rake effective_polls:notify

namespace :effective_polls do
  desc 'Send email notifications for effective polls'
  task notify: :environment do
    poll_notifications = Effective::PollNotification.all.deep.notifiable

    poll_notifications.find_each do |notification|
      begin
        notified = notification.notify!
        puts "Sent #{notification.category} for #{notification.poll}" if notified
      rescue => e
        if defined?(ExceptionNotifier)
          ExceptionNotifier.notify_exception(e, data: { poll_notification_id: notification.id, poll_id: notification.poll_id })
        end

        puts "Error with effective poll_notification #{notification.id}: #{e.errors.inspect}"
      end
    end

    puts 'All done'
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
effective_polls-0.3.0 lib/tasks/effective_polls_tasks.rake
effective_polls-0.2.0 lib/tasks/effective_polls_tasks.rake
effective_polls-0.1.6 lib/tasks/effective_polls_tasks.rake
effective_polls-0.1.5 lib/tasks/effective_polls_tasks.rake
effective_polls-0.1.4 lib/tasks/effective_polls_tasks.rake
effective_polls-0.1.3 lib/tasks/effective_polls_tasks.rake
effective_polls-0.1.2 lib/tasks/effective_polls_tasks.rake
effective_polls-0.1.1 lib/tasks/effective_polls_tasks.rake
effective_polls-0.1.0 lib/tasks/effective_polls_tasks.rake