title: Referring to instance in has_many (Rails)
body: <p>I have a Game model which has_many :texts. The problem is that I have to order the texts differently depending on which game they belong to (yes, ugly, but it's legacy data). I created a <code>Text.in_game_order_query(game)</code> method, which returns the appropriate ordering.</p>
  
  <p>My favourite solution would have been to place a default scope in the Text model, but that would require knowing which game they're part of. I also don't want to create separate classes for the texts for each game - there are many games, with more coming up, and all the newer ones will use the same ordering. So I had another idea: ordering texts in the has_many, when I do know which game they're part of:</p>
  
  <pre><code>has_many :texts, :order =&gt; Text.in_game_order_query(self)
  </code></pre>
  
  <p>However, self is the class here, so that doesn't work.</p>
  
  <p>Is there really no other solution except calling <code>@game.texts.in_game_order(@game)</code> every single time??</p>