My bad, I did not completely scrub the example of my original table/column
names. Your example definitely helped as I came up with this working query.
Also I did not know about the ___ notation as I had not noticed it in the
docs before. The use of %w is definitely cleaner here as well.
irb(main):086:0> ap
DB[:albums___a].left_join(:albumsstags___at,:albumid=>:id).left_join(:tags___t,:id=>:tagid).where(:country=>%w'us
uk',:style=>%w'rap country',:name=>%w[red blue]).select(:title).sql
"SELECT `title` FROM `albums` AS `a` LEFT JOIN `albumsstags` AS `at` ON
(`at`.`albumid` = `a`.`id`) LEFT JOIN `tags` AS `t` ON (`t`.`id` =
`at`.`tagid`) WHERE ((`country` IN ('us', 'uk')) AND (`style` IN ('rap',
'country')) AND (`name` IN ('red', 'blue')))"
Thank you, I learned much about sequel in getting through this:)
As another question, should this be done with models and if so what would
that look like?
--
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.