My issue is with a single table, Conferences, that uses a column parent_id to reference itself. This way, I identify big conferences (like NCAA) and the smaller conferences that make it up (like PAC 10). What I'd like to do is use the :order modifier of the find method to sort each conference by it's parent's name. The best I've gotten so far is being able to sort by the parent's ID (which isn't particularly helpful).
One thought was to change my reference column from parent_id to parent_name (and force these to be unique). However, I'm guessing that would break the :counter_cache functionality. Anyone know what I should do? Thanks.
#model class Conference < ActiveRecord::Base has_many :teams belongs_to :conference, :foreign_key => "parent_id", :counter_cache => true end
#table columns id name abbr parent_id conferences_count teams_count
#controller @conferences = Conference.find(:all, :order => 'parent_id')