Displaying non-empty defaults for sort drop-downs? #163

jlstr opened this Issue Nov 14, 2012 · 1 comment


None yet
2 participants

jlstr commented Nov 14, 2012

Hello guys!

Sorting a model works very well via: build_sort, But is there a way to change the defaults displayed for the drop downs that ransack generates? The defaults are No-Field, No-Option Selected. Can I change that to something different to be displayed when the page loads?

This Question has more details about what I'm trying to accomplish:


Thanks in advance!

znz commented Jan 10, 2013

Default sort order can set by sorts= .

for example:
@search.sorts = 'updated_at desc' if @search.sorts.empty?
@search.sorts = ['name asc', 'updated_at desc'] if @search.sorts.empty?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment