【问题标题】:Simpleform order association简单形式的订单关联
【发布时间】:2012-09-16 23:37:01
【问题描述】:

在使用 simpleform 时,如何通过关联对选择选项进行排序?我有这样的事情:

= f.association :color

【问题讨论】:

    标签: ruby-on-rails-3 simple-form


    【解决方案1】:

    您可以将collection 选项传递给关联:

    = f.association :color, collection: Color.order('created_at ASC')
    

    【讨论】:

      猜你喜欢
      • 2023-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多