Guest User

Untitled

a guest
Jul 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. Item
  2. has_many :half_links
  3. belongs_to: category
  4.  
  5. Category
  6. has_many :items
  7.  
  8. HalfLinks
  9. belongs_to :other_item, :class_name => "Item", :foreign_key => :other_item
  10.  
  11. <table>
  12. <tr>
  13. <td>item_id, cat_id</td>
  14. <td>Item name</td>
  15. <td>Item Category</td>
  16. <td>Pic</td>
  17. </tr>
  18. <% @itemhl.each do |hl| %>
  19. <tr>
  20. <td><%= hl.other_item_id %> <%= hl.other_category_id %></td>
  21. <td><%= link_to hl.other_item.name, item_path(hl.other_item) %></td>
  22. <td><%= link_to hl.other_item.category.name, category_path(hl.other_item.category) %></td>
  23. <td><%= image_tag hl.other_item.itemimage.url(:thumb) %></td>
  24. </tr>
  25. <% end %>
  26. </table>
  27. </p>
  28.  
  29. @itemhlc = @itemhl.map{|c| c.other_item.category.name }.uniq
Add Comment
Please, Sign In to add comment