我是 Ruby on Rails 的新手。如何在两列中显示产品?
当我写以下内容时,右列会显示相同的产品,但我想在左列显示一些,在右列显示一些。
#main_container
.left_col
%div{"data-hook" => "___homepage_featured_products"}
%h3
Featured Activities
- @featured.each do |pr|
- @product = pr
%a.box{:href=>url_for(@product), :title=>"#{@product.name} | #{@product.location}"}
- if @product.images[0]
.img{:style=>"background-image: url('#{@product.images[0].attachment.url(:original)}')"}
.details
%h3
= @product.name.truncate 20
%p.infos
= image_tag @product.activity_type.icon, :class=>"pictogram" rescue ''
%span= @product.activity_type.name.titleize rescue ''
\/
%span.price= number_to_currency @product.price rescue ''
\/
= @product.location
\/
= @product.level
%p
= @product.description.truncate(120) rescue ''
.right_col