Ruby on Rails, Using sort on each do

ruby, ruby-on-rails

Solution

Assuming the `Category` is an `Active Record` then

`<% Category.order(:id).limit(4).each do |type| %>` would do the trick.

Problem

I'm trying to use sort on each do. I get the error wrong number of arguments(1 for 0) I understand that I cannot daisy chain them together. Does anyone know another methods of getting this done. ``` <% Category.sort(:id).limit(4).each do |type| %> <%= type.name %> <% end %> ``` The result I am aiming for is to have all categories listed from a to z.

Original source