How is the conditional operator (? :) used in Ruby?

For example, is this correct?

<% question = question.size > 20 ? question.question.slice(0, 20)+"..." : question.question %>

7 Answers
7

Leave a Reply

Your email address will not be published. Required fields are marked *