Using || in Case switch in Rails

喜夏-厌秋 提交于 2019-12-02 23:28:23

This is what you want:

<% case @page_title when "Log in", "Forgot Your Password", "Create a New Password" %><%= render :partial => "common/hello-world" -%><% end -%>

Per http://docs.huihoo.com/ruby/ruby-man-1.4/syntax.html#case

Use , instead of || to separate the matches after when. See more about Ruby syntax in http://docs.huihoo.com/ruby/ruby-man-1.4/syntax.html#case.

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