-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add parent_sql #422
Comments
Hello @andrelip We currently do not string munge. If I hear you correctly, you would like something like the following (none of this code works, just trying to understand your use case): clients = Records.where(:id => [1,2,3,4,5])
result = clients.map(&:parent).map(&:name)
#
Record.parents_of(Records.where(:id => [1,2,3,4,5]).pluck(:name)
# =>
SELECT name
FROM records
WHERE id IN (
SELECT SUBSTRING_INDEX(ancestry, '/', -1)::INTEGER
FROM records WHERE id IN (1,2,3,4,5)
) There problem currently lies in the Do you have any suggestions for that block of code? |
this is also related to #308 |
actually the problem is we can not currently implement I am looking into this. |
When retrieving the parent resource name for a list of clients I had to rely on N+1 when accessing the data using Rails. With Elixir and I could easily retrieve and query that list by joining a substring:
Is there a native functionality for including and querying in this library?
The text was updated successfully, but these errors were encountered: