Files
nairobi/app/models
Javi Martín a0942f66bf Fix crash destroying budgets with admins/valuators
We don't allow deleting a budget with associated investments. However,
we allow deleting a budget with associated administrators and valuators.
This results in a foreign key violation error:

PG::ForeignKeyViolation: ERROR:  update or delete on table "budgets"
violates foreign key constraint "fk_rails_c847a52b1d" on table
"budget_administrators"

Using the `dependent: :destroy` option when defining the relationship,
we remove the association records when removing the budget.

As a bonus, we reduce the number of Rubocop offenses regarding the
`Rails/HasManyOrHasOneDependent` rule. Only 72 to go! :)
2021-06-02 17:07:04 +02:00
..
2021-03-02 13:15:15 +01:00
2021-03-02 13:15:15 +01:00
2020-10-15 14:57:42 +02:00
2021-01-14 17:37:58 +01:00
2020-12-16 11:43:17 +01:00
2021-04-08 17:23:30 +02:00
2020-10-15 14:57:42 +02:00
2019-03-27 15:22:14 +01:00
2021-04-13 13:52:18 +02:00
2020-12-15 11:57:09 +01:00
2019-10-23 14:39:31 +02:00
2019-03-14 17:25:43 +01:00
2019-04-29 13:08:43 -05:00
2020-12-21 18:04:48 +01:00
2020-12-02 12:13:02 +01:00
2020-04-09 07:11:53 +10:00
2019-02-05 17:41:00 +01:00
2019-10-25 19:29:12 +02:00
2021-01-12 14:50:37 +01:00