Here's the scenario. I have a 'post' table (I've chosen not to use pluralization), and a 'postmeta' table. The 'post' table stores the main post information, such as title, body and date_created. The 'postmeta' table stores metadata associated with the post, such as tags, and the post type (e.g. whether the post is an article or a blog entry).
I've created models for both the post and postmeta tables, like so... class Postmeta < Sequel::Model many_to_one :post end class Post < Sequel::Model one_to_many :postmeta end The association works fine, I can assure you. My problem is, I can't for the life of me, work out how to select all posts with the 'type' of 'blog'. Of course, the 'type' information is stored in the 'postmeta' table, so here's how I'd write that in pure SQL... SELECT * FROM post JOIN postmeta ON postmeta.post_id = post.id WHERE postmeta.name = 'type' AND postmeta.value = 'blog' Very straight-forward as you can see, but how do you do it using models in sequel? I've scoured the documentation (or so I think), but have turned up dry. Any help is as always, very much appreciated! -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. 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.
