Collect your parameters into an array, as you did:
options = Portal.all.collect{|p| [p.name, portal_datum_path(p.id)]}, [@portal.name, portal_datum_path(@portal)])
Then sort:
options.sort!{ |x, y| x[0] <=> y[0] }
I do this in the monkeys patch options_for_select, which is part of the module that I created to handle all kinds of selection material, since sort like this sorting is more common than not.
def options_for_select(options, selected_items:nil, alphabetize: true) options.sort!{ |x, y| x[0] <=> y[0] } if alphabetize super(options, selected_items) end
source share