Commit 295d4ac9 by vulehuan

update code: create user before insert products (product belongs to user)

parent 9172a24c
...@@ -34,6 +34,16 @@ namespace :db do ...@@ -34,6 +34,16 @@ namespace :db do
) )
end end
# Create admin account (product belongs to user)
@user = User.new(
name: "admin",
email: "admin@local.net",
admin: true,
password: "123456",
password_confirmation: "123456"
)
@user.save
# Product list # Product list
# http://developer.yahoo.co.jp/webapi/shopping/shopping/v1/itemsearch.html # http://developer.yahoo.co.jp/webapi/shopping/shopping/v1/itemsearch.html
list_url = 'http://shopping.yahooapis.jp/ShoppingWebService/V1/itemSearch' list_url = 'http://shopping.yahooapis.jp/ShoppingWebService/V1/itemSearch'
...@@ -95,6 +105,7 @@ namespace :db do ...@@ -95,6 +105,7 @@ namespace :db do
price_currency: price_currency, price_currency: price_currency,
price: price, price: price,
product_category_id: category_id, product_category_id: category_id,
user_id: @user.id,
status: true status: true
) )
rescue rescue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment