Hello. I have what i assume is a simple problem. I have want to be able
to sort a dataset by referencing the text name of a related class.
For example: let’s pretend I have these models: “things” and “colors”.
Things “belongs_to” Colors and Colors “has_one” things.
Thing.color_id = Color.id
So, Thing.color.name = Color.name where Thing.color_id == Color.id
You get it.
So, I want to do this:
mythings = Thing.find(:all, :order => on Thing.color.name)
I want to be able to sort all my things by the colors (red, blue, etc)
by name and not their ID in the database.