Last active
November 27, 2018 09:18
-
-
Save Levii01/3ebc4ab8ebe23c90bee504f6a110818a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Campaign | |
has_many: :message_sets, dependent: :destroy | |
has_many: :sms_messages, through: :messages | |
SmsMessages | |
has_many: :tracking_links, dependent: :destroy | |
TrackingLinks | |
has_many: :sth_associations, dependent: :destroy | |
Usuwanie Sms Messages trwa zbyt długo (jest ich sporo), bo za każdym razem przy usuwaniu rekordu sprawdza też TrackingLinks. | |
Przyspieszyłem to usuwając wszystkie tracking_linksy należące do Campaign. Działa to faktycznie szybciej. | |
używając `sms_messages.destroy_all` wciąż zagląda do TrackingLinksów | |
W tej chwili użym `delete_all` ale bardzo bym chciał zostać przy `destroy_all` żeby nie było bubla jak ktoś dołoży dependency: :destroy na kolejną relację. | |
Świetnym wyjściem byłoby skip_callback na destroy dla `:tracking_links` czego nie wiem jak zeobić, internet też tak sobie. | |
Ale może za bardzo się z tym kopie i to co zrobiłem jest wystarczające. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment