On Tuesday, May 6, 2014 5:43:24 AM UTC-7, Johannes Held wrote:
>
> Hello,
>
> first I want to thank you for this toolkit. I found it recently and fell 
> in love with it. :)
>
> Documentation for the plugin many_through_many (
> http://sequel.jeremyevans.net/rdoc-plugins/classes/Sequel/Plugins/ManyThroughMany.html
> ).
>
> Artist.plugin :many_through_many
> Artist.many_through_many :tags, [[:albums_artists, :artist_id, :album_id], 
> [:albums, :id, :id], [:albums_tags, :album_id, :tag_id]]
> →
> FROM artists
> JOIN albums_artists ON (artists.id = albums_artists.artist_id)
> JOIN albums ON (albums_artists.album_id = albums.id)
> JOIN albums_tags ON (albums.id = albums_tag.album_id)
> JOIN tags ON (albums_tags.tag_id = tags.id)
>
> I think that you can remove , [:albums, :id, :id] in your first example, as 
> the join of albums doesn''t seem to be required:
>
>
> Artist.plugin :many_through_many
> Artist.many_through_many :tags, [[:albums_artists, :artist_id, :album_id], 
> [:albums_tags, :album_id, :tag_id]]
>
> →
>
> FROM artists
> JOIN albums_artists ON (artists.id = albums_artists.artist_id)
> JOIN albums_tags ON (albums_artists.album_id = albums_tag.album_id)
> JOIN tags ON (albums_tags.tag_id = tags.id)
>
>
I think it makes sense to update the current example.  While it isn't 
wrong, it can be simplified as you point out.  I'll make this change soon.

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