title: Ruby/Rails sort_by date desc, name asc
body: <p>I'm creating a list page of two different classes and I'd like to sort them by date desc, name asc. Both have datetime fields with a date method in each model.</p>
  
  <pre><code>posts = Post.all
  news = News.all
  @news_and_posts = posts.zip(news).compact.select(&amp;:date).sort {|x| [-x.date, x.name]}
  </code></pre>
  
  <p>This throws a NoMethodError:
  undefined method `-@' for Tue, 11 Nov 2014:Date</p>
  
  <p>On several other questions this answer was given within both sort_by and sort, but I'm not having any luck.</p>
  
  <p>Rails 4.0.5
  Ruby 2.1.3</p>