Can you explain the ternary operator here? I understand the value if it is false, but why is the value, 2.5, if, review.rating.nil? is true?  

You could also implement the following code for the method, 
return 'N/A' if reviews.empty?
ratings = reviews.map(&:rating)
ratings.sum / ratings.count