On Thursday, March 27, 2014 7:00:30 AM UTC-7, Oldřich Vetešník wrote:
>
> Hello again,
>
> I either discovered a bug or I am using it wrong: when the eager_each 
> plugin is enabled and multiple association joins are called on a dataset, 
> an error is thrown. (`[]' for nil:NilClass)
> I made a gist of the problem and a test case: 
> https://gist.github.com/ollie/9807923
>
> The short version is:
>
> class User < Sequel::Model
>   one_to_many :orders
>   one_to_many :redemptions, class: :Order, key: :code_user_id
> end
>
> class Order < Sequel::Model
>   plugin :eager_each
>
>   many_to_one :user
>   many_to_one :code_user, class: :User
> end
>
> Order.association_join(:user).association_left_join(:code_user) # errs
>
> The use case:
>
> I have a list of orders, each order has a user (which cannot be null) and 
> a code user (which can be null).
> By "code" I mean some kind of promo string which is points to some user 
> (although it is not in the migration).
> I want to list a table of orders with inner joins on the order user and 
> outer join on the code user.
>
> Current workaround is either call Order.association_left_join(:user, 
> :code_user) or get rid of the eager plugin.
> I don't actually mind doing either of those but if this is a bug I thought 
> I should report it.
>

Thanks for reporting.  This was a bug in the eager_each plugin, where it 
would attempt to eager load when trying to get the columns for the dataset. 
 I'm testing a fix now, it should be pushed up to GitHub shortly.

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

Reply via email to