How to give sort_by name in where condition in rails -


i have included given code

  @operator_selected = operator.where(:id => selected_operator).map{|opr| opr.name} 

i want show operator sort name. please guide me how this.

try this

@operator_selected = operator.where(:id => selected_operator).order(:name).map{|opr| opr.name} 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -