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
Post a Comment