Skip to content

Commit

Permalink
レビュー対応
Browse files Browse the repository at this point in the history
  • Loading branch information
KOH6 committed Sep 6, 2023
1 parent 385ea4a commit 03343f3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ def index

def show
@product = Product.find(params[:id])
@products = Product.order(created_at: :desc).limit(4)
@recommended_products = Product.where.not(id: params[:id]).order(created_at: :desc).limit(4)
end
end
2 changes: 1 addition & 1 deletion app/helpers/products_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module ProductsHelper
def convert_to_jpy(price)
"#{price.to_fs(:delimited, delimiter: ',')}円"
"#{price.to_fs(:delimited)}円"
end
end
2 changes: 1 addition & 1 deletion app/views/products/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="container px-4 px-lg-5 mt-5">
<h2 class="fw-bolder mb-4">一緒に購入されている商品</h2>
<div class="row gx-4 gx-lg-5 row-cols-2 row-cols-md-3 row-cols-xl-4 justify-content-center">
<% @products.each do |product| %>
<% @recommended_products.each do |product| %>
<%= render 'card', :product => product %>
<% end %>
</div>
Expand Down

0 comments on commit 03343f3

Please sign in to comment.