Category Archives: SQL

:has_many Associations with Complex Joins (Kind of)

In this episode, your fearless Jedi delves within the dark tree of associations, with_scope, inner joins, duck typing and meta-programming all in an effort to keep DRY… In Joyomi I create an Omi when I lend you a book. I … Continue reading

Posted in Ruby on Rails, SQL | 1 Comment

Put NULLS Last on MySQL

NULLs are a wonderful but strange feature of SQL. They are the source of some deep coolness but also some lost hair. One place where NULLs can bite you is when you are sorting. The way you sort in SQL … Continue reading

Posted in Ruby on Rails, SQL | 17 Comments