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
@ggLee6352map was used to process *ancestors arguments if given any to filter out the results that is descendants of given ancestors. If no argument passed, then will use all scope instead
Model.with_ancestor(1, 2).to_sql
=>SELECT"models".*FROM"models"INNER JOIN"model_hierarchies"ON"model_hierarchies"."descendant_id"="models"."id"WHERE"model_hierarchies"."ancestor_id"IN (1, 2) AND (model_hierarchies.generations>0)
Model.with_ancestor([1, 2]).to_sql
=>SELECT"models".*FROM"models"INNER JOIN"model_hierarchies"ON"model_hierarchies"."descendant_id"="models"."id"WHERE"model_hierarchies"."ancestor_id"IN (1, 2) AND (model_hierarchies.generations>0)
Model.with_ancestor.to_sql
=>SELECT"models".*FROM"models"
Your example by removing ancestors.map { ... } will raise error caused ancestor_ids was not defined since with_ancestor method was a class method not instance method (with_ancestor defined under ClassMethods module)
seem to be the same
The text was updated successfully, but these errors were encountered: