
Untitled
By: a guest on
May 9th, 2012 | syntax:
None | size: 0.44 KB | hits: 9 | expires: Never
Associations of records of one table are in another
Users: id, title
Infos: id, type, user_id_createdby, user_id_addressedto, text
Infos record: id: 1, type: "nextmeeting", user_id_createdby: 47, user_id_addressedto: 51, text: "2011/01/13"
@users = User.joins("LEFT OUTER JOIN infos ON infos.user_id_createdby = users.id")
@users = User.joins("LEFT OUTER JOIN infos ON infos.user_id_createdby = users.id").order("infos.text DESC")