Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simpleform order association

While using simpleform how do I order the select options with an association? I have something like this:

= f.association :color
like image 555
Mike Silvis Avatar asked Jul 10 '26 01:07

Mike Silvis


1 Answers

You can pass a collection option to association:

= f.association :color, collection: Color.order('created_at ASC')
like image 63
Vasiliy Ermolovich Avatar answered Jul 14 '26 00:07

Vasiliy Ermolovich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!