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
We have many models and where we want to introduce hoardable to. The issue is that the default_scope is overriding already existing logic.
eg. Suddenly, this works differently
# includes versions now as well
user.documents
document.attachments
attachment.variants
...
We have close to 100 models, and going through all relations like this and adjusting it is not feasible plus it is very hard to catch in tests as versions will only appear if there has been an update to the record.
There will be a forgotten relation somewhere that will break stuff that we won't catch therefore we currently are unable to.
Could you suggest or implement a nicer way to handle this? It is currently very difficult to bring hoardable to ongoing projects.
The text was updated successfully, but these errors were encountered:
unfortunately I don't anticipate changing the behavior of using default_scope to inject hoardable's ability to exclude versions in the near future. there isn't another self-evident Rails-y way to add scoping to all queries generated for a model that i'm aware of. if anyone else has ideas, i'm very open to them.
generally, i've found the usage of default_scope in application business logic to be an anti-pattern. my hope in using default_scope in hoardable was that it would be unused and available for establishing the base control over the table inheritance querying.
my suggestion would be to either remove the application's usage of default_scope for those models, or add hoardable's exclude_versions to your custom default_scopes. if neither of those solutions work for you, this might not be the right versioning gem for your use-case.
We have many models and where we want to introduce hoardable to. The issue is that the
default_scope
is overriding already existing logic.eg. Suddenly, this works differently
We have close to 100 models, and going through all relations like this and adjusting it is not feasible plus it is very hard to catch in tests as versions will only appear if there has been an update to the record.
There will be a forgotten relation somewhere that will break stuff that we won't catch therefore we currently are unable to.
Could you suggest or implement a nicer way to handle this? It is currently very difficult to bring hoardable to ongoing projects.
The text was updated successfully, but these errors were encountered: