0
我遇到了一些问题,我认为是我的缓存。无法将字符串转换为真
我收到此错误信息:
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
行。
该代码大部分时间都有效,但有时会引发此错误。 我在一段时间内没有看到我的自我,但Exceptional告诉我,过去7天的错误已经增加了500多倍。
我使用:
- HAML 3.1.2
- 轨3.1
- memcached的1.4.5
- 达利1.0.5
Here是完整的堆栈跟踪。
一些注意事项:当使用插值字符串时,不要执行'to_s'。不要在您发布的堆栈跟踪中误用括号'image_tag(movie.poster,size:“60x92”)' – phoet
,它看起来像缓存返回true而不是字符串。你在别的地方使用相同的缓存键吗? – phoet