I'm trying to do the example in the docs:

https://sequel.jeremyevans.net/rdoc/files/doc/advanced_associations_rdoc.html


Artist.one_to_one :first_album, class: :Album, order: :release_date, 
eager_limit_strategy: :distinct_on Artist.where(id: 
[1,2]).eager(:first_album).all 

# SELECT DISTINCT ON (albums.artist_id) * # FROM albums # WHERE 
(albums.artist_id IN (1, 2)) # ORDER BY albums.artist_id, release_date

When I try to run this exact same instance with:

one_to_one :last_edit, class: "PostEdit", order: :created_at, 
eager_limit_strategy: :distinct_on

I get:

Post.where(:id=>[1,2]).eager(:last_edit) 

=> #<Sequel::Postgres::Dataset: "SELECT \"posts\".* FROM \"posts\" WHERE 
(\"id\" IN (1, 2))">

So it's leaving off the entire extra amount.

Also, when I do Post.dataset.association_join(:last_edit), how do I have it 
use a window function with a limit 1 and sort it by created_at?

I'm on Sequel 5.34.0 if that's helpful.

Aryk

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/fb288800-7296-439e-bb63-903db0b41903n%40googlegroups.com.

Reply via email to