title: Rails 4 Update Lambda Expression for has_many
body: <p>I updated my <code>Rails</code> app from version <code>Rails 3.0</code> to <code>Rails 4.1</code> and I've got the following error:</p>
  
  <pre><code>ArgumentError: Unknown key: :order. Valid keys are: :class_name, :class, :for...
  </code></pre>
  
  <p>The problem appears in the following line:</p>
  
  <pre><code>has_many :downloads, :dependent =&gt; :destroy, :order =&gt; "downloads.position DESC"
  </code></pre>
  
  <p>After a little google research, the line looks like this:</p>
  
  <pre><code>has_many :downloads, :dependent =&gt; :destroy, -&gt; {order('downloads.position DESC')}
  </code></pre>
  
  <p>And now I've got the error:</p>
  
  <pre><code>syntax error, unexpected '\n', expecting tASSOC
  </code></pre>
  
  <p>I also tried other variations but nothing worked. I hope you can help me.</p>