Skip to content

Commit

Permalink
Fix for DfE::Analytics crashing on installation (#93)
Browse files Browse the repository at this point in the history
*Add check for analytics file into initialize method
  • Loading branch information
ericaporter authored Oct 27, 2023
1 parent a630d17 commit fe73499
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/dfe/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ def self.initialize!
return
end

unless Rails.env.production? || File.exist?(Rails.root.join('config/initializers/dfe_analytics.rb'))
message = "Warning: DfE Analytics is not set up. Run: 'bundle exec rails generate dfe:analytics:install'"
Rails.logger.info(message)
puts message
return
end

raise ActiveRecord::PendingMigrationError if ActiveRecord::Base.connection.migration_context.needs_migration?

DfE::Analytics::Fields.check!
Expand Down

0 comments on commit fe73499

Please sign in to comment.