Is there any possible way to code this in one line? sometthing like <%= “A” if …….>
<% if @box == 'inbox' && m.is_read?(current_user) %>
A
<% else %>
B
<% end %>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need a ternary operator – also known as the “conditional” operator in Ruby, which returns “A” if the expression before
?is true, and “B” if the expression is false.