Add seeds for don
|
@ -79,10 +79,6 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def user_params
|
||||
if params[:user]
|
||||
params.require(:user).permit(:avatar)
|
||||
else
|
||||
{}
|
||||
end
|
||||
params.permit(:user).permit(:avatar)
|
||||
end
|
||||
end
|
||||
|
|
93
db/seeds.rb
|
@ -11,25 +11,88 @@ DEFAULT_PASSWORD = "password"
|
|||
|
||||
products = [
|
||||
{
|
||||
name: 'Fanta',
|
||||
price: 0.6,
|
||||
category: 'beverages',
|
||||
stock: 25,
|
||||
avatar: File.new('public/seeds/products/fanta.jpg', 'r')
|
||||
name: "Twix",
|
||||
price: 0.4,
|
||||
category: "food",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/1.jpg', 'r')
|
||||
},
|
||||
{
|
||||
name: 'Club Mate',
|
||||
price: 1.2,
|
||||
category: 'beverages',
|
||||
stock: 25,
|
||||
avatar: File.new('public/seeds/products/club_mate.jpg', 'r')
|
||||
name: "M&M Peanuts",
|
||||
price: 0.6,
|
||||
category: "food",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/2.jpg', 'r')
|
||||
},
|
||||
{
|
||||
name: 'Kinder Bueno',
|
||||
price: 0.6,
|
||||
category: 'food',
|
||||
stock: 15,
|
||||
avatar: File.new('public/seeds/products/bueno.jpg', 'r')
|
||||
name: "Snickers",
|
||||
price: 0.4,
|
||||
category: "food",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/3.jpg', 'r')
|
||||
},
|
||||
{
|
||||
name: "Fanta",
|
||||
price: 0.6,
|
||||
category: "beverages",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/4.jpg', 'r')
|
||||
},
|
||||
{
|
||||
name: "Ice Tea",
|
||||
price: 0.7,
|
||||
category: "beverages",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/5.jpg', 'r')
|
||||
},
|
||||
{
|
||||
name: "Cola",
|
||||
price: 0.6,
|
||||
category: "beverages",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/6.jpg', 'r')
|
||||
},
|
||||
{
|
||||
name: "Abrikozencake",
|
||||
price: 0.4,
|
||||
category: "food",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/7.jpg', 'r')
|
||||
},
|
||||
{
|
||||
name: "Kinder Delice",
|
||||
price: 0.4,
|
||||
category: "food",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/8.jpg', 'r')
|
||||
},
|
||||
{
|
||||
name: "Kinder Bueno",
|
||||
price: 0.6,
|
||||
category: "food",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/9.jpg', 'r')
|
||||
},
|
||||
{
|
||||
name: "Arizona Ice Tea",
|
||||
price: 1.0,
|
||||
category: "beverages",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/10.png', 'r')
|
||||
},
|
||||
{
|
||||
name: "Dinosauruskoeken",
|
||||
price: 0.5,
|
||||
category: "food",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/11.jpg', 'r')
|
||||
},
|
||||
{
|
||||
name: "Chocolade - melk",
|
||||
price: 0.7,
|
||||
category: "food",
|
||||
stock: 0,
|
||||
avatar: File.new('public/seeds/products/12.jpg', 'r')
|
||||
}
|
||||
]
|
||||
|
||||
|
|
BIN
public/seeds/products/1.jpg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
public/seeds/products/10.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
public/seeds/products/11.jpg
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
public/seeds/products/12.jpg
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
public/seeds/products/2.jpg
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
public/seeds/products/3.jpg
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
public/seeds/products/4.jpg
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
public/seeds/products/5.jpg
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
public/seeds/products/6.jpg
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
public/seeds/products/7.jpg
Normal file
After Width: | Height: | Size: 6 KiB |
BIN
public/seeds/products/8.jpg
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
public/seeds/products/9.jpg
Normal file
After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 244 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 54 KiB |