We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6207b0a commit 9c2b515Copy full SHA for 9c2b515
2 files changed
pdv/app/controllers/products_controller.rb
@@ -5,12 +5,12 @@ class ProductsController < ApplicationController
5
def index
6
@products = Product.all
7
8
- render json: @products
+ render json: {data: @products}
9
end
10
11
# GET /products/1
12
def show
13
- render json: @product
+ render json: {data: @product}
14
15
16
# POST /products
pdv/db/seeds.rb
@@ -23,3 +23,13 @@
23
access: 1,
24
name: 'Vinicius Arruda')
25
26
+10.times do
27
+ Product.create({
28
+ sku: Faker::Number.number(6),
29
+ item: Faker::Book.title,
30
+ color: Faker::Color.hex_color,
31
+ size: 'M',
32
+ cod: Faker::Number.between(1, 50),
33
+ stock: Faker::Number.between(1, 20)
34
+ })
35
+end
0 commit comments