小编cor*_*eyt的帖子

Rails 3 +设计 - 如何设计回应JSON

我的环境是带有Devise 1.1的Rails 3.0.1.我正在开发一个移动Web应用程序,主要使用javascript,并且希望尽可能多地保持基于JSON的通信.

有没有办法让设计用JSON响应成功/失败消息,而不是必须遵循302重定向并解析HTML?

看着用这个.

......但是没有它工作.

json ruby-on-rails devise

8
推荐指数
1
解决办法
6313
查看次数

Rails 3资产管道+ Apache + Phusion Passenger

我正在使用Rails 3.1 w/asset pipeline,phusion 3.0.x和apache 2.2.17.

http://guides.rubyonrails.org/asset_pipeline.html的配置文档中,在4.1.1节中,它指出我需要在我的apache配置中添加一个部分:

<LocationMatch "^/assets/.*$">
  # Some browsers still send conditional-GET requests if there's a
  # Last-Modified header or an ETag header even if they haven't 
  # reached the expiry date sent in the Expires header.
  Header unset Last-Modified
  Header unset ETag
  FileETag None
  # RFC says only cache for 1 year
  ExpiresActive On
  ExpiresDefault "access plus 1 year"
</LocationMatch>
Run Code Online (Sandbox Code Playgroud)

我一直认为Phusion Passenger刚刚"处理"了这个......或者我是不是在忽视RTFM?如果我想利用指纹识别,我是否需要将其添加到apache配置中?

apache ruby-on-rails passenger ruby-on-rails-3 asset-pipeline

6
推荐指数
1
解决办法
3490
查看次数

如何将文件从 Google Cloud 复制到本地机器?(云壳)

我花了太多时间试图弄清楚如何将文件从分配的 Google Cloud Shell VM 复制到我的本地机器。云外壳很棒,但拥有本地副本也很棒。

大部分时间都花在尝试使某种形式的gcloud compute scp工作上,类似于以下语法:

$ gcloud compute scp some-instance:~/littlefile.zip ~/

但是,除了compute命令之外,还有alpha cloud-shell!

无效的方法:

me@mylocalhost:~$ gcloud alpha cloud-shell scp ~/littlefile.zip .
ERROR: (gcloud.alpha.cloud-shell.scp) argument (cloudshell|localhost):SRC: Bad value [/home/me/littlefile.zip]: must start with cloudshell: or localhost:

Run Code Online (Sandbox Code Playgroud)
me@mylocalhost:~$ gcloud alpha cloud-shell scp cloudshell:~/littlefile.zip localhost:~/littlefile.zip
~/littlefile.zip: No such file or directory
ERROR: (gcloud.alpha.cloud-shell.scp) [/usr/bin/scp] exited with return code [1].
Run Code Online (Sandbox Code Playgroud)

提及:如何将文件从 google 计算引擎复制到本地目录,以防其他人找到它但需要 Cloud Shell 命令。

google-compute-engine google-cloud-platform google-cloud-shell

2
推荐指数
1
解决办法
1931
查看次数