无法将true转换为String [英] can't convert true into String

查看:99
本文介绍了无法将true转换为String的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为我的缓存存在一些问题.

I'm having some problem with what I think is my cache.

我收到此错误消息:

ListsUsersController# (ActionView::Template::Error) "can't convert true into String"

这是代码:

%footer
  - cache "footer-movies-#{Time.now.hour.to_s}", expires_in: 2.days do
    .foot-movies
      %ul
        - Movie.footer.each do |movie|
          %li= link_to (image_tag movie.poster, size: "60x92"), movie_path(movie), title: movie.title

它在抱怨第40行,这是包含.foot-movies的行.

It's complaining about line 40, which is the line containing .foot-movies.

该代码大多数时候都可以工作,但有时会出现此错误. 一段时间以来,我还没有看到自己的情况,但是异常告诉我该错误已引发500多个最近7天的时间.

The code works most of the time, but sometimes raises this error. I've not seen it my self in a while, but Exceptional tells me that the error has been raised over 500 times the last 7 days.

我正在使用:

  • haml 3.1.2
  • rails 3.1
  • memcached 1.4.5
  • dalli 1.0.5

此处是完整的堆栈跟踪.

推荐答案

您拥有的其中一个变量或方法中没有字符串,其简单的'true'和ruby不会将其转换为字符串.您必须找出其中的哪一个,并确保其传递正确的值

One of the variables or methods you have doesn't have a string in it its simply 'true' and ruby wont convert that to a string. You'd have to hunt down which of these it is and make sure its passing the right value

这篇关于无法将true转换为String的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆