按字母顺序排序时忽略区分大小写

时间:2017-05-24 23:06:43

标签: ruby-on-rails activeadmin

当我在ActiveAdmin中对模型的名称列进行排序时,我得到如下输出:

  • 苹果
  • 冰柱
  • Zebras
  • iMacs
  • 的iPhone

其中大写和小写字母似乎单独排序。我更喜欢以下列方式显示已排序的列:

  • 苹果
  • 冰柱
  • 的iMac
  • 的iPhone
  • 斑马

在有效管理员中对列进行排序时,是否可以帮助我找出忽略区分大小写的另一种方法。我有一个postgres数据库这里是我的代码片段,但由于一些奇怪的原因不起作用:

  package org.apache.cxf.transport.servlet.servicelist;

  /*--imports--*/

  public class FormattedServiceListWriter implements ServiceListWriter {

      /*... this remains the same as in the original class*/

      public void writeServiceList(PrintWriter writer,
                                   String basePath,
                                   AbstractDestination[] soapDestinations,
                                   AbstractDestination[] restDestinations) throws IOException {

          /*this is the method you should change*/

          writer.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" "
                       + "\"http://www.w3.org/TR/html4/loose.dtd\">");
          writer.write("<HTML><HEAD>");
          writer.write("<LINK type=\"text/css\" rel=\"stylesheet\" href=\"" + styleSheetPath + "\">");
          writer.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">");
          if (title != null) {
              writer.write("<title>" + title + "</title>");
          } else {
              writer.write("<title>CXF - Service list</title>");
          }
          writer.write("</head><body>");


          writer.write("<span class=\"heading\">WHATEVER YOU WANT TO PUT HERE</span>");

          writer.write("</body></html>");
      }

      /*... this remains the same as in the original class*/

  }

关于什么会导致它的任何想法?它只需要排序约30项。 (另外,我已经提到相关/可能的重复问题,但解决方案也不起作用,我不确定为什么逻辑似乎很好。谢谢!

相关问题