I'm fairly new to Sequel, but I had a lot of experience with ActiveRecord.
I have Quiz model, which has many Questions. I'm trying to do a search
which returns quizzes, but which also searches associated questions (I
know, the basics :P). Now, I'm really impressed with Sequel's joins,
ActiveRecord really sucks when it comes to joins. So, I have something like
this:
Quiz.association_right_join(:questions).to_a
# => [#<Quiz @values={:id=>73, :quiz_id=>152, ...>]
What happens is that columns are kind of joined together, which I
understand. But what I find strange is that questions take over, and
quizzes retreat ("id" becomes "quiz_id"). I find this strange, because if
I'm searching *quizzes*, shouldn't *questions* be the second-class citizens
(that questions' "id" turn into "question_id")?
Also, is it possible to disable joining values? Because I only want to do a
query, I don't need questions' columns. Maybe a "where" subquery would be
better for that, without joining? How would I write it?
Thanks,
Janko
--
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.