Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-07-07 12:57:34 +0300
committerSean McGivern <sean@gitlab.com>2017-07-07 14:42:38 +0300
commit38fd773bd3bb7ff479ca3d607da6966139e262e3 (patch)
treed866d1f88f52388b554699b2e19c832c9fe284bd /app/models/concerns/sha_attribute.rb
parentde2d5ce685877249434ba412b5839910bc703882 (diff)
Fix ShaAttribute concern when there is no table
When this is added to a new model, it would fail before the migrations were run - including when trying to run migrations in production mode!
Diffstat (limited to 'app/models/concerns/sha_attribute.rb')
-rw-r--r--app/models/concerns/sha_attribute.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/concerns/sha_attribute.rb b/app/models/concerns/sha_attribute.rb
index c28974a3cdf..67ecf470f7e 100644
--- a/app/models/concerns/sha_attribute.rb
+++ b/app/models/concerns/sha_attribute.rb
@@ -3,6 +3,8 @@ module ShaAttribute
module ClassMethods
def sha_attribute(name)
+ return unless table_exists?
+
column = columns.find { |c| c.name == name.to_s }
# In case the table doesn't exist we won't be able to find the column,