Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Item
- has_many :half_links
- belongs_to: category
- Category
- has_many :items
- HalfLinks
- belongs_to :other_item, :class_name => "Item", :foreign_key => :other_item
- <table>
- <tr>
- <td>item_id, cat_id</td>
- <td>Item name</td>
- <td>Item Category</td>
- <td>Pic</td>
- </tr>
- <% @itemhl.each do |hl| %>
- <tr>
- <td><%= hl.other_item_id %> <%= hl.other_category_id %></td>
- <td><%= link_to hl.other_item.name, item_path(hl.other_item) %></td>
- <td><%= link_to hl.other_item.category.name, category_path(hl.other_item.category) %></td>
- <td><%= image_tag hl.other_item.itemimage.url(:thumb) %></td>
- </tr>
- <% end %>
- </table>
- </p>
- @itemhlc = @itemhl.map{|c| c.other_item.category.name }.uniq
Add Comment
Please, Sign In to add comment