Reputation: 6259
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!
Upvotes: 0
Views: 306
Reputation: 2741
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
.
Upvotes: 2