can't convert true into String

夙愿已清 提交于 2019-12-12 04:29:07

问题


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

I'm getting this error message:

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

Here is the code:

%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

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

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.

I'm using:

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

Here is the full stacktrace.


回答1:


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



来源:https://stackoverflow.com/questions/7292538/cant-convert-true-into-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!