On Thursday, July 25, 2013 10:32:33 AM UTC-7, Heberto del Rio wrote:

> When I run the following command: Course.join(Faculty, :id=> 
> :instructor_id).sql I obtain: 
> "SELECT * FROM `courses` INNER JOIN `faculties` ON (`faculties`.`id` = 
> `courses`.`instructor_id`)" 
>
> Since I am actually joining the model Course with the model Student (from 
> left to right) I know that I should be expecting an array of Course 
> instances, which I am fine with it.
>
> Here is the problem for any element of this array, let us say course, 
> course.name containes the name of the Faculty joined not the name of the 
> course, why is that? what am I doing wrong and how to fix this problem?
>

You probably want to add a select_all(:courses) to the dataset, so it will 
do SELECT courses.* instead of SELECT *.

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/groups/opt_out.


Reply via email to