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 (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开发者_JS百科 have a second nested if statement and break it apart...not pretty :(
<% if (from_today(contact, call.days) == (0..7) && show_status(contact, call) == 'no status') %>
Try putting the 0..7
in parentheses. The &&
is not your problem here.
精彩评论