Topic: Sortig

I am having a problem sorting where the it sorts upper case and the lover case
A, B, a, b ...

I was trying to make the string lower but it's not working quite right.


def index 
  @account = Account.order("LOWER("+ sort_column +")" + " " + sort_direction) # DOES NOT WORK 
  #@account = Account.order(sort_column + " " + sort_direction) # A, B, a, b .... In proper sort 
end 
private

  def sort_column
    Account.column_names.include?(params[:sort]) ? params[:sort] : "name"
  end

  def sort_direction
    %w[asc desc].include?(params[:direction]) ? params[:direction] : "asc"
  end