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
So can you guys help me to find a way to change this default dataset as ROM document suggests and I believe this will also help to configure other ROM changes as well when we use ROM through Hanami.
Main goal is to remove default ordering that ROM provides on primary key.
The text was updated successfully, but these errors were encountered:
I am also interested in this. We are introducing soft deletion by adding something like a deleted_at column in the table. However, we have a lot of existing queries and aggregations such that going through existing repository methods one-by-one to add a where(deleted_at: nil) is not feasible.
After digging through the docs and codebase, I am currently stuck at monkey patching the Repository's self.load! method. I'm wondering if there's a better way around this?
classBookRepository < Hanami::Repositorydefself.load!superconfiguration.setup.relation_classes.eachdo |klass|
# .root => :books. This is to skip other relations included as associationsnextunlessklass.register_as == rootklass.datasetdowhere(Sequel[:books][:deleted_at]=>nil)# overrides default dataset hereendendendend
As ROM is providing way to adjust default dataset here: https://rom-rb.org/3.0/learn/sql/relations/
I'm trying to change default dataset(remove default ordering) in latest hanami application and it seems that changing
dataset
isn't available here: https://github.com/hanami/model/blob/1.3.x/lib/hanami/repository.rbSo can you guys help me to find a way to change this default dataset as ROM document suggests and I believe this will also help to configure other ROM changes as well when we use ROM through Hanami.
Main goal is to remove default ordering that ROM provides on primary key.
The text was updated successfully, but these errors were encountered: