Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #CONTROLLER
- # GET /mobiles/archive/
- def archive
- @mobiles = Mobile.all
- @mobile_brands = @mobiles.group_by { |m| m.brand }
- end
- #VIEW
- <% @mobile_brands.sort.each do |brand, mobiles| %>
- <h2><%= brand.name %></h2>
- <% for mobile in mobiles %>
- <div class="mobile">
- <strong><%= mobile.name %></strong>
- </div>
- <% end %>
- <% end %>
- # ERROR
- undefined method `<=>' for #<Brand:0x24f6954>
- Extracted source (around line #3):
- 1:
- 2:
- 3: <% @mobile_brands.sort.each do |brand, mobiles| %>
- 4: <h2>hej</h2>
- 5: <% for mobile in mobiles %>
- 6: <div class="task">
Add Comment
Please, Sign In to add comment