I cannot figure the correct wording for this scope method. The task is to create a scope method that specifies the requests(which have notes) to display only the requests with the word "kids" in the note . I can't seem to get the right wording for this to work
I have tried scope :requests_with_kids_in_note, -> { where('note').includes(text: "kids")}
scope :requests_with_kids_in_note, -> { select('note').where('note').includes(text: "kids")}
error messages aren't helping
You can do this very easily through scopes, but you should format the where clause differently. Also I'd advise to make it more generic:
scope :note_contains, -> (word) { where('note LIKE %?%', word) }
And use it like this:
Model.note_contains('kids')