0

I have this code:

  @note = @patient.notes.find(params[:id])
  @notes = @patient.notes.where(jahr: @note.jahr, quartal: @note.quartal).except(@note)

Somehow the .except(@note) is not working, i get no error, but @note is still contained in @notes What do i wrong? Thanks!

John Smith
  • 6,105
  • 16
  • 58
  • 109

1 Answers1

2

except is used to skip parts of your query, as in .except(:where) to skip the where clause. You might want to use something like .where('notes.id != ?', @note.id) instead. Or in Rails 4, where.not.

jimworm
  • 2,731
  • 18
  • 26