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.
Assuming the Category is an Active Record then
<% Category.order(:id).limit(4).each do |type| %>   would do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With