lib/notifiable/notification.rb in notifiable-rails-0.26.0 vs lib/notifiable/notification.rb in notifiable-rails-0.26.1
- old
+ new
@@ -6,12 +6,18 @@
serialize :parameters
has_many :notification_statuses, :class_name => 'Notifiable::NotificationStatus', :dependent => :destroy
- def batch
- yield(self)
- close
+ def batch
+ begin
+ yield(self)
+ update(last_error_message: nil)
+ rescue Exception => e
+ update(last_error_message: e.message)
+ ensure
+ close
+ end
end
def add_device_token(d)
provider = d.provider.to_sym
\ No newline at end of file