mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 14:19:49 +08:00
54cae1299e
Unfortunately, Discourse's `UserOption` model is not currently autoloaded. That means that modifying it via a `reloadable_patch` will try to apply the changes repeatedly. Normally this doesn't matter since the changes are idempotent. However, introducing ActiveRecord enums is not idempotent - they raise an error if the same enum already exists on the model. This commit adds a check to avoid hitting this 'duplicate definition' error. Reproduced ``` rails runner 'Rails.application.reloader.reload!' ``` |
||
---|---|---|
.. | ||
chat | ||
discourse_dev | ||
email_controller_helper | ||
onebox/templates | ||
tasks | ||
service_runner.rb |