Skip to content

Instantly share code, notes, and snippets.

@mattiasarro
Created December 8, 2014 14:50
Show Gist options
  • Save mattiasarro/a8652218ed1dd6c0d609 to your computer and use it in GitHub Desktop.
Save mattiasarro/a8652218ed1dd6c0d609 to your computer and use it in GitHub Desktop.
diff --git a/app/models/ticketing/ticket_transaction.rb b/app/models/ticketing/ticket_transaction.rb
index 50b3a3c..3a6ea7d 100644
--- a/app/models/ticketing/ticket_transaction.rb
+++ b/app/models/ticketing/ticket_transaction.rb
@@ -48,12 +48,20 @@ class TicketTransaction < ActiveRecord::Base
def state_cleared
self.update_column(:cleared_at, DateTime.now)
+ complete! unless require_guest_names
end
def state_completed
self.transaction do
tickets.reserved.each do |ticket|
ticket.confirm!
+ TicketMailer.send_to_guest(ticket)
+ end
+
+ if require_guest_names
+ TicketMailer.send_to_member(self.tickets.where(email: nil))
+ else
+ TicketMailer.send_to_member(self.tickets)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment