From 375a5c9f1e69a5fbf49a98cecc7f0c0cb61df989 Mon Sep 17 00:00:00 2001 From: Andreas Brandl Date: Mon, 26 Feb 2018 16:44:35 +0100 Subject: Only track contributions if table is available. This is due to the problem that the callback can be called while running an earlier database schema version (for example during earlier migrations). We work around this by checking the current schema version and only track contributions if the table is available. --- app/models/event.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/models/event.rb') diff --git a/app/models/event.rb b/app/models/event.rb index f0cc99a9242..e855ed02274 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -392,6 +392,9 @@ class Event < ActiveRecord::Base end def track_user_contributed_projects - UserContributedProjects.track(self) + # Note the call to .available? is due to earlier migrations + # that would otherwise conflict with the call to .track + # (because the table does not exist yet). + UserContributedProjects.track(self) if UserContributedProjects.available? end end -- cgit v1.2.1