diff options
| author | Teddy Wing | 2017-09-11 12:39:14 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-09-11 12:49:45 +0200 |
| commit | 7ff60302d391afd850733d7ddade238bef502d70 (patch) | |
| tree | 5e8f19e9cab501452044438e07bab3052a2e158d | |
| parent | 70215298fcb592e52b0f3033a939a594f511e379 (diff) | |
| download | chouette-core-7ff60302d391afd850733d7ddade238bef502d70.tar.bz2 | |
ImportMessage: Remove `dependent: :destroy` on :resource association
It doesn't really make sense to have a `dependent: :destroy` here. For
one thing, the `Import` class has the necessary `dependent: :destroy`
definitions to remove its associated objects when it gets deleted.
At this point, according to Luc, we don't envision deleting
`ImportResource`s separately from `Import`s.
The other weird thing is that:
* `ImportResource` has many `ImportMessage`s
* `ImportMessage` has one `ImportResource`
With the `dependent: :destroy` set up the way it is here on
`ImportMessage`, we could potentially be deleting an `ImportResource`
with other `ImportMessage` children that would then become orphaned.
For both these reasons, it seems better to remove this trigger.
Refs #4412
| -rw-r--r-- | app/models/import_message.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/import_message.rb b/app/models/import_message.rb index 913f6fd41..5d0f5c862 100644 --- a/app/models/import_message.rb +++ b/app/models/import_message.rb @@ -1,6 +1,6 @@ class ImportMessage < ActiveRecord::Base belongs_to :import - belongs_to :resource, class_name: ImportResource, dependent: :destroy + belongs_to :resource, class_name: ImportResource enum criticity: [:info, :warning, :error] validates :criticity, presence: true |
