title: How do I exclude search results in ActiveRecord?
body: <p>I am attempting to write an ActiveRecord Query which will return the records of all characters and non_player_characters in the same square as the current_user, while excluding the current_user from the result. </p>
  
  <pre><code>class Square
    def self.characters(user)
      characters = []
      players = Character.all
      bots = NonPlayerCharacter.all
      characters &lt;&lt; bots.find_by(x_coordinate: user.x_coordinate, y_coordinate: user.y_coordinate)
      characters &lt;&lt; players.find_by(x_coordinate: user.x_coordinate, y_coordinate: user.y_coordinate)
    end
  end
  </code></pre>
  
  <p>I read <a href="http://guides.rubyonrails.org/active_record_querying.html#not-conditions" rel="nofollow">rails guides</a>, it told me how to exclude items from my search results but only in the context of a single command. In other words, after reading it I could not figure out how to chain not conditions with the find_by method.</p>