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.
{instead ofdo, and}, instead ofendCategoryis an ActiveRecord model, you want.order(:id).limit(4).