我正在使用 Ruby on Rails 从 mySQL 数据库中获取数据,如下所示:
def all_specs
Specialization.order("title ASC").all;
end
现在,我想像这样在视图文件中对这些数据进行排序:
<div class="nav-column">
<h3>A</h3>
<ul class="submenu">
<li><a href="#">All data that has title that starts with A</a></li>
</ul>
</div>
<div class="nav-column">
<h3>A</h3>
<ul class="submenu">
<li><a href="#">All data that has title that starts with B</a></li>
</ul>
</div>
and so on from A-Z
我怎样才能做到这一点?