You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rubocop 0.50.0 includes a new rails cop (PR) for recommending an enforced dependent attribute on has_many or has_one associations.
It seems reasonable to me to include these, but at least for me, is not how I've written associations thus far, unless necessary. Granted, now that we have foreign_key constraints, if you're using them and don't provide a dependent action, then your deletion is going to fail, due to a foreign key constraint error.
Anyhow, I wanted to raise awareness on this if nothing else, but also give people the chance to chime in on the default configuration (to warn about the lack of a dependent attribute), but also if people have guidelines/suggestions on which dependent option to use in certain scenarios, if we want to get that far in the weeds (rubocop won't advise on what option to use, just to have one).
The text was updated successfully, but these errors were encountered:
Rubocop 0.50.0 includes a new rails cop (PR) for recommending an enforced
dependent
attribute onhas_many
orhas_one
associations.It seems reasonable to me to include these, but at least for me, is not how I've written associations thus far, unless necessary. Granted, now that we have foreign_key constraints, if you're using them and don't provide a dependent action, then your deletion is going to fail, due to a foreign key constraint error.
Anyhow, I wanted to raise awareness on this if nothing else, but also give people the chance to chime in on the default configuration (to warn about the lack of a dependent attribute), but also if people have guidelines/suggestions on which dependent option to use in certain scenarios, if we want to get that far in the weeds (rubocop won't advise on what option to use, just to have one).
The text was updated successfully, but these errors were encountered: