Rails Join question with has_many relationship -


I am working to sort the table based on Railscast episodes per head. My table is slightly different from that header references an affiliate field. I have everything that is beyond peaching, when I sort by that affiliate field, it only gives to those elements who have access to this (optional) field. Here is the code that orders the case:

  @ user.items.joins (: location) .order ('places.title asc')   < P> Basically, a user has X multiple items, each has an alternate location. I just want to be able to sort at that place. I'm not sure how to specify that I want all the items, not just for those people who have a place.  

If you include (: location) / Code> Instead you will still receive all the items, even if no related location is present.

Comments