Grouped Collection Select Alphabetical Order Rails

前端 未结 5 1341
天命终不由人
天命终不由人 2021-01-03 05:27

I finally figured out how to implement Dynamic Select menus using this tutorial.

Everything works, But how does one organize the Cities in t

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-03 05:46

    If using Rails 5.X, you can use default_scope, in which the syntax is slightly different than in @zeantsoi answer.

    default_scope { order('cities.name ASC') }
    
    

提交回复
热议问题