Rails 3 sorting through parent association

后端 未结 1 575
傲寒
傲寒 2021-02-13 16:32

I have a fairly straightforward question in Rails 3 to which I can\'t seem to find the answer:

Let\'s say I have 2 models: Customer, Project.

A Customer has_many

相关标签:
1条回答
  • 2021-02-13 16:55
    Project.joins(:customer).order('customers.name')
    
    0 讨论(0)
提交回复
热议问题