title: Receiving database error when using find_or_initialize_by_ticker
body: <p>I'm running an association find_or_initialize_by_ticker method and keep receiving</p>
  
  <pre><code>PG::InFailedSqlTransaction: ERROR:  current transaction is aborted,
  commands ignored until end of transaction block
  </code></pre>
  
  <p>My position has a stock_id attribute and I want to check whether or not a particular stock object exists for any of my positions.</p>
  
  <p>If a stock object already exists, then I can grab it and if not a new position will be created and I can use that object.</p>
  
  <p>I was thinking of writing my own method with an association extension like</p>
  
  <pre><code>has_many :positions do
    def find_or_initialize_by_ticker(ticker)
      position_with_ticker = self.select do |position|
        position.stock['symbol'] == ticker
      end
      if position_with_ticker
        position_with_ticker.first
      else
        Position.new
      end
    end
  end
  </code></pre>
  
  <p>Is this the most efficient way to find a position?</p>