在index.html.erb里面有以下代码
<video width="320" height="240" controls="controls">
<source src="truffle1.mp4"/>
Your browser does not support the video tag.
</video>
Run Code Online (Sandbox Code Playgroud)
我不知道在哪里放我的mp4视频文件所以我把它放在几个地方.
接下来,我启动rails服务器并使用Chrome打开索引页面.我看到黑色视频帧,但它没有播放.当我尝试在新窗口中打开视频时 我得到无路由匹配[GET]"/admin/truffle1.mp4"(注意admin只是控制器的命名空间).
好像这是一个rails路由问题......
我设置了一个简单的新rails应用程序,带有模型入口,属性title和content使用脚手架.
现在我正在尝试使用curl来发布JSON数据(而不是使用浏览器).
以下似乎工作(即成功发布空数据):
curl --verbose --header "Accept: application/json" --header "Content-type: application/json" --request POST --data "" http://localhost:3000/entries
Run Code Online (Sandbox Code Playgroud)
以下不起作用:
curl --verbose --header "Accept: application/json" --header "Content-type: application/json" --request POST --data "{'content':'I belong to AAA','title':'AAA'}" http://localhost:3000/entries
Run Code Online (Sandbox Code Playgroud)
我尝试了很多变化.我得到的错误主要是JSON数据中未找到主机或意外令牌.
var o = {};
(function(x){x=null})(o); //o is NOT null after this statement
(function(x){x.foo = "foo"; x.bar = "bar";})(o) //o has properties foo and bar after this statement
Run Code Online (Sandbox Code Playgroud)
将对象o传递给函数时会发生什么?第一个功能使得它似乎没有通过; 第二个函数使它看起来像是通过了