Sometimes we want to do something like:

Page.eager_graph(:user).select(:pages__name, :users__name).first

But this relies on the fact that we know the table names for our Sequel 
Models Page and User. What if they're set up this way?

class Page < Sequel::Model(:page)
end
class User < Sequel::Model(:jsec_user)
end

I guess we could define it like:

class Page < Sequel::Model(:page__p)
end

But what if you need to do some query where there is a self reference, like 
if a page could have a parent page?

So, I was thinking that we could handle aliasing in Sequel models like this:

Page.as(:p).eager_graph(:user, as: :u).select(:p__name, :u__name).first

Well, this is just an idea. Since I'm starting to use Sequel more often 
maybe there is already another way to handle this without being too verbose 
but I couldn't find it in the docs.

By the way, I don't like the idea of adding extensions to core classes, so 
I stopped using MongoMapper and I'm requiring Sequel without the core 
extensions.

I can't seem to find much documentation on how to do certain things without 
those query extensions. For example, see the equivalent codes:

where('email is not null')
where{~ {email: null} }

How to do the above without enabling the core extensions?

Cheers,
Rodrigo.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/abWa3epW5lEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to