简体   繁体   English

如何在Ruby on Rails中使用&& in?

[英]How can I use && in if in Ruby on Rails?

I tried the following && conditional for my if statement and I get a "bad range" error: 我尝试了以下&&条件为我的if语句,我得到一个“坏范围”错误:

<% if (from_today(contact, call.days) == 0..7) && (show_status(contact, call) == 'no status') %>

Why and how can I fix it? 为什么以及如何解决它? The only other way I could do it was to have a second nested if statement and break it apart...not pretty :( 我能做到的唯一另一种方法是使用第二个嵌套的if语句并将其分开...不漂亮:(

<% if (from_today(contact, call.days) == (0..7) && show_status(contact, call) == 'no status') %>

Try putting the 0..7 in parentheses. 尝试将0..7放在括号中。 The && is not your problem here. &&这不是你的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM