0

I got these 2 boolean functions:

 def settled?
    self.settled == true
 end

 def negative_pl?
    self.profitloss < 0
 end

How can I test for both of them at the same time? I want to do something like this in my view:

<%= 'classRed' if bet.settled?.negative_pl? %>

I know the above don't work, but the best way to explain what I want to do :)

Thanks!

2 Answers 2

1
<%= 'classRed' if bet.settled? and bet.negative_pl? %>
Sign up to request clarification or add additional context in comments.

Comments

1

You need a clause per check:

if bet.settled? and bet.negative_pl?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.