I guess I don't really understand how `eager_graph` works. Looking through
all the examples it seems you need to set up a relation and all eager_graph
to load it, but in this case what I'm specifically interested in is
generating a query that I can pass variables into, not hardcoded
constraints.
The behavior I want to write would be something like this pseudo code:
Conversation.with_messages_from_user_and_load_only_the_messages_from_this_user(user).all
Where the output from the previous example would be:
conversations #=> [Conversation[1], Conversation[2]]
and if you looped like this:
puts "Search results:"
conversations.each do |conv|
puts "Conversation #{conv.id}"
conv.messages.each{|m| puts "#{m.user.name}:\n#{m.text}" }
puts "----"
end
You'd get the following
Search Result:
Conversation 1
User 1
Hello, World!
----
Conversation 2
User 1
phone home
----
How would you do that with eager_graph?
On Monday, October 31, 2016 at 9:29:25 AM UTC-4, Jeremy Evans wrote:
Can't you do what you want using eager_graph instead of eager?
>
> Thanks,
> Jeremy
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.