Skip to content

Commit

Permalink
Fixed multiple application notifications
Browse files Browse the repository at this point in the history
When there were multiple applications set up, all notifications were
sent as if belong to the first one.
  • Loading branch information
calonso committed Sep 21, 2012
1 parent 46b53f1 commit e01fb1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/apn_on_rails/app/models/apn/app.rb
Expand Up @@ -40,7 +40,7 @@ def self.send_notifications
def self.send_notifications_for_cert(the_cert, app_id)
begin
APN::Connection.open_for_delivery({:cert => the_cert}) do |conn, sock|
unset = APN::Notification.where(:sent_at => nil).order(:device_id, :created_at)
unset = APN::Notification.joins(:device).where(:sent_at => nil, :apn_devices => { :app_id => app_id }).order(:device_id, :created_at)
unset.each do |noty|
Rails.logger.debug "Sending notification ##{noty.id}"
begin
Expand Down

0 comments on commit e01fb1c

Please sign in to comment.