I apologize for any poor terminology I use, as I'm a pretty green (Rails) programmer. But here is my question: I'm working on a Rails app (2.3.8) that manages projects. Every project has one company (in a separate table) and one contact (in a separate table). I'm currently generating a list of projects which is ordered (1) by company and (2) by contact. The problem is that I need that list in alphabetical order (based on the name of the company/contact). As of now, the best I can do is order the list by the company/contact ID, which is what the projects table is storing. What are my options—if any?
Here is what my controller currently uses to order the list I need:
def jobs_to_be_invoiced
@to_be_invoiced_prep = Project.prepare_project("To Be Invoiced", "=")
@to_be_invoiced = @jobs_to_be_invoiced_prep.all(:order => 'company_id, contact_id')
end