Project

General

Profile

Bug #23398

Exception thrown from local dev sever on code modifications

Added by Peter Lehwess almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Development tools
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

When modifying code locally then the local sever will throw the exception AuditAssociations::AssociationsDefinitions has been removed from the module tree
but is still active!'

This can be seen when editing a model that inherits from ApplicationModel and then trying to access any page in the locally running server in the browser.


Related issues

Related to Foreman - Bug #23195: associations are not audited on creationClosed2018-04-10

Associated revisions

Revision d81dc2a0 (diff)
Added by Peter Lehwess almost 5 years ago

Fixes #23398 - Don't extend classes from within initializers

Any changes to the code locally will kick in rails's auto loading which
in turn will then reload all relevant classes, and in the case of
changing a model inheriting from ApplicationRecord, then
ApplicationRecord be reloaded. So since ApplicationRecord was being
extended from within the initializer for audit then it will load the
extend however the module with still be hanging around, causing rails
throw an argument error: 'A copy of
AuditAssociations::AssociationsDefinitions has been removed from the
module tree but is still active!'.

Also note, audit_associations needs to be required because at the time
of app start up during initialization the audit_associations has not yet
been loaded. See the config/application.rb for the loading order and one
can see that models are loaded long before the audit_associations.

History

#1 Updated by The Foreman Bot almost 5 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5496 added

#2 Updated by Timo Goebel almost 5 years ago

  • Related to Bug #23195: associations are not audited on creation added

#3 Updated by Timo Goebel almost 5 years ago

  • Legacy Backlogs Release (now unused) deleted (330)

#4 Updated by Timo Goebel almost 5 years ago

  • Assignee set to Peter Lehwess

#5 Updated by Anonymous almost 5 years ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

#6 Updated by Marek Hulán almost 5 years ago

  • Legacy Backlogs Release (now unused) set to 353

#7 Updated by Ewoud Kohl van Wijngaarden over 4 years ago

  • Triaged set to No
  • Category set to Development tools

Also available in: Atom PDF