Simple order association

When using simpleform, how can I order selection options using associations? I have something like this:

= f.association :color 
+4
source share
1 answer

You can pass the collection parameter to the association:

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

Source: https://habr.com/ru/post/1434508/


All Articles