Homeland ruby-china 代码中的疑问贴 [欢迎跟贴]

buyhome · 2012年08月06日 · 最后由 buyhome 回复于 2012年08月13日 · 2867 次阅读

这段时间仔细看了华顺兄的 commit 记录,我才来不久,对早期的修改不怎么了解,可以说刚处于入门阶段,对工程中有不少疑问,还望多多指教。

问题 1、config.yml 中的 google_js_api_key

在 config.yml 中有一个 google_js_api_key,不知道是否为统计用的?

google_js_api_key: "ABQIAAAAC-ble-vmy_g7-Qvem5P86xTX2XchcwgyHzp4Xo0DHRAzt2aLjhQnflwIyCJBOWYCE_rFuUkE0qEmhw"

在 view/layout/application.html.erb 最下面有这段

<script>
  var _gaq=[['_setAccount','<%= Setting.google_analytics_key %>'],['_trackPageview']];
  (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
  g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
  s.parentNode.insertBefore(g,s)}(document,'script'));
</script>

可是我在工程的配置文件中找不到 google_analytics_key 的设定。google_analytics_key 的值得应该就是形如 UA-33885764-1 吧?在哪里配置呢?

找半天原来也在 config.yml 中

google_analytics_key: ""
upload_url: ""
upyun_username: ""
upyun_password: ""
upyun_bucket: ""
google_group_email: ""
email_sender: ''
aws_access_key_id: ''
aws_secret_access_key: ''
twitter_token: ""
twitter_secret: ""
github_token: ""
github_secret: ""
douban_token: ""
douban_secret: ""
google_js_api_key: ""

最后 google_js_api_key 是做什么用的呢?

config.yml.default line 7

配置了 google_analytics_key,不过没有数据。会不会和日志中的错误有关

>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 10240
>> Listening on 0.0.0.0:3001, CTRL+C to stop
!! Rack application returned nil body. Probably you wanted it to be an empty string?
!! Unexpected error while processing request: undefined method `each' for nil:NilClass
!! Rack application returned nil body. Probably you wanted it to be an empty string?
!! Unexpected error while processing request: undefined method `each' for nil:NilClass
!! Rack application returned nil body. Probably you wanted it to be an empty string?
!! Unexpected error while processing request: undefined method `each' for nil:NilClass
!! Rack application returned nil body. Probably you wanted it to be an empty string?
!! Unexpected error while processing request: undefined method `each' for nil:NilClass
!! Rack application returned nil body. Probably you wanted it to be an empty string?
!! Unexpected error while processing request: undefined method `each' for nil:NilClass
!! Rack application returned nil body. Probably you wanted it to be an empty string?
!! Unexpected error while processing request: undefined method `each' for nil:NilClass

这个错误很多的。

#3 楼 @buyhome 是改用 thin 启动 ruby-china 才发现的问题

!! Rack application returned nil body. Probably you wanted it to be an empty string?
!! Unexpected error while processing request: undefined method `each' for nil:NilClass

#4 楼 @buyhome 刚刚也碰到这个问题,看看 Memcached 是否开启?

#5 楼 @yesmeck 的确是这个问题:

tcp        0      0 ::1:11211        ::1:52936        ESTABLISHED 10204/memcached     
tcp        0      0 ::1:52936        ::1:11211        ESTABLISHED 10851/thin server ( 

不过又有新的问题了,回复帖子,被重复回复两次。

@yesmeck 切换到 production,没有重复发评论的问题了。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号