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
For an AR model VirtualPath used for a DB based file system, we use this excellent gem.
When loading a bunch of the models after applying access control and other restrictions, we build up the hierarchy for a recursive "ls" style output and use ancestry_path for the parts.
To speed up loading the ancestors, we try to use eager loading:
However, this mixes up the order of the ancestry path elements.
Activity
dup2 commentedon Jan 5, 2021
It seems that the ordering is lost when doing eager_load and the method
ancestory_pathrelies on this order.Using
.eager_load(:self_and_ancestors).order("virtual_path_hierarchies.generations" => :asc)seems to fix this.Any clue why this is the case?