From 38fd773bd3bb7ff479ca3d607da6966139e262e3 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 7 Jul 2017 10:57:34 +0100 Subject: 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! --- app/models/concerns/sha_attribute.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app') 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, -- cgit v1.2.3