Skip to content

Instantly share code, notes, and snippets.

View goodbomb's full-sized avatar

Ben Scott goodbomb

  • Software Engineering Manager
  • Burnaby, BC
View GitHub Profile
# Update Business' supported_causes list and Cause's list of supporters
def update_supporters
@transaction = Transaction.find(self.id)
@type = @transaction.trans_type
@status = @transaction.status
if @type == 'pledge' && @status == 'complete' then
@business_id = @transaction.from_user_id
@cause_id = @transaction.to_user_id
b = User.find(@business_id)
b.supported_causes += Array(@cause_id)