diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 8cc71e9..4e7bdd1 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -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 diff --git a/app/helpers/products_helper.rb b/app/helpers/products_helper.rb index 71830bf..89f954f 100644 --- a/app/helpers/products_helper.rb +++ b/app/helpers/products_helper.rb @@ -2,6 +2,6 @@ module ProductsHelper def convert_to_jpy(price) - "#{price.to_fs(:delimited, delimiter: ',')}円" + "#{price.to_fs(:delimited)}円" end end diff --git a/app/views/products/show.html.erb b/app/views/products/show.html.erb index dc872f0..7b7758d 100644 --- a/app/views/products/show.html.erb +++ b/app/views/products/show.html.erb @@ -44,7 +44,7 @@

一緒に購入されている商品

- <% @products.each do |product| %> + <% @recommended_products.each do |product| %> <%= render 'card', :product => product %> <% end %>