I have some eager loading that I need to make happen sometimes on single 
rows and other times for lists. See the code sample below with some 
comments but I was curious if there is any (technical) reason why .first 
and .first! should not perform eager loading or if there is a better work 
around than using .all.first and then raising the errors myself?

class User < Sequel::Model(:users)

  dataset_module do

    def eager_relationships
      # setup some eager loads here 
    end    

  end

end

User.where(id: [1,2,3]).eager_relationships.all # eager loads
User.where(id: 1).eager_relationships.first! # does not eager load

User.dataset = User.dataset.clone.eager_relationships # will make first, 
all, each eager load

-Robert

-- 
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 http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to