Skip to content

Commit

Permalink
fix: product controller
Browse files Browse the repository at this point in the history
  • Loading branch information
afrijaldz committed Dec 5, 2024
1 parent 83be033 commit 8d4a2ef
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions app/controllers/api/v1/products_controller.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
class Api::V1::ProductsController < ApplicationController
before_action :set_product, only: [:show, :update, :destroy]

Check failure on line 2 in app/controllers/api/v1/products_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideArrayLiteralBrackets: Use space inside array brackets.

Check failure on line 2 in app/controllers/api/v1/products_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/SpaceInsideArrayLiteralBrackets: Use space inside array brackets.

Check failure on line 3 in app/controllers/api/v1/products_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/TrailingWhitespace: Trailing whitespace detected.
# GET /products
def index
@products = Product.all.with_attached_image
render json: @products.map { |product| product_json(product) }
end

Check failure on line 8 in app/controllers/api/v1/products_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/TrailingWhitespace: Trailing whitespace detected.
# GET /products/:id
def show
render json: product_json(@product)
end

Check failure on line 12 in app/controllers/api/v1/products_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/TrailingWhitespace: Trailing whitespace detected.
# POST /products
def create
@product = Product.new(flat_product_params)
if @product.save
Expand All @@ -22,7 +19,6 @@ def create
end
end

Check failure on line 21 in app/controllers/api/v1/products_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/TrailingWhitespace: Trailing whitespace detected.
# PUT /products/:id
def update
if @product.update(flat_product_params)
render json: product_json(@product)
Expand All @@ -31,7 +27,6 @@ def update
end
end

Check failure on line 29 in app/controllers/api/v1/products_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/TrailingWhitespace: Trailing whitespace detected.
# DELETE /products/:id
def destroy
@product.destroy
head :no_content
Expand Down

0 comments on commit 8d4a2ef

Please sign in to comment.