我正在运行以下脚本
mysql -u $_db_user -p$_db_password $_db << eof
INSERT INTO \`manufacturemap\`
(\`manufacture_id`\ `manufacture_name`\) VALUES (122,IBM)
eof
done
exit
但它显示以下错误
bad substitution: no closing "`" in `manufacture_name'\) VALUES (122,IBM))
我已经尝试了所有我知道的事情,请帮助,有点卡在这里。
答案 0 :(得分:1)
缺少require "rest_client"
class Affiliate < ActiveRecord::Base
def self.fetch
response = RestClient::Request.execute(
:method => :get,
:url => "http://api.shopstyle.com/api/v2/products?pid=uid7849-6112293-28&fts=women&offset=0&limit=10"
)
@products = JSON.parse(response)["products"].map do |product|
product = OpenStruct.new(product)
affiliate = Affiliate.find_or_create_by(:name => product.name, :url => product.url)
affiliate.save
end
end
end
和错误的,
in - &gt;
\
应该是 -
(\`manufacture_id`\ `manufacture_name`\)
不需要转义 -
(\`manufacture_id\`, \`manufacture_name\`)