title: Rails 4: undefined method `where' for Array:
body: <p>My understanding was that Rails 4 (using 4.2.5) supported using a .where() operator on arrays. </p>
  
  <p>However, the line 3 of the code below (in which Author belongs to User and has many Publications) throws <code>NoMethodError: undefined method 'where' for #&lt;Array:0x007fd8be73e850&gt;</code>.</p>
  
  <pre><code>@authors = current_user.authors
  @pubs = @authors.map(&amp;:publications).flatten.uniq
  @scoped = @pubs.where(name: "Publication")
  </code></pre>
  
  <p>I originally thought that it may be down to the <code>.flatten</code> part, but removing it doesn't make any difference. Can anyone shed some light?</p>