Guest User

Untitled

a guest
May 24th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1.  
  2. #CONTROLLER
  3.  
  4. # GET /mobiles/archive/
  5. def archive
  6.  
  7. @mobiles = Mobile.all
  8. @mobile_brands = @mobiles.group_by { |m| m.brand }
  9.  
  10. end
  11.  
  12. #VIEW
  13.  
  14. <% @mobile_brands.sort.each do |brand, mobiles| %>
  15. <h2><%= brand.name %></h2>
  16. <% for mobile in mobiles %>
  17. <div class="mobile">
  18. <strong><%= mobile.name %></strong>
  19. </div>
  20. <% end %>
  21. <% end %>
  22.  
  23. # ERROR
  24.  
  25. undefined method `<=>' for #<Brand:0x24f6954>
  26.  
  27. Extracted source (around line #3):
  28.  
  29. 1:
  30. 2:
  31. 3: <% @mobile_brands.sort.each do |brand, mobiles| %>
  32. 4: <h2>hej</h2>
  33. 5: <% for mobile in mobiles %>
  34. 6: <div class="task">
Add Comment
Please, Sign In to add comment