Ruby On Rails: Order by child attribute
ruby-on-rails
Solution
I'm going to use lowercase letters instead:
a_instances.sort_by{|a| [a.b.y, a.x]}
Problem
If I have a model A that has an attribute X and a child model of A called B with an attribute Y, how can I order all the instances of A by Y and X?