title: question mark and colon - if else in ruby
body: <p>Hi I have a question about ruby on rails</p>
  
  <p>Apparently I have a statement like this: </p>
  
  <pre><code>def sort_column
      Product.column_names.include?(params[:sort]) ? params[:sort] : "name"
  end
  </code></pre>
  
  <p>From what I read, it's said that this method sort the column based on params[:sort] and if there no params the products will be sorted by "name". However, I don't understand the way this statement is written, especially the second "?". Can someone explain it to me ? </p>