From 5ae260dc2cc00802024b1840e3f0511e182b782b Mon Sep 17 00:00:00 2001 From: Tom Luce Date: Mon, 15 Feb 2021 21:46:50 +0000 Subject: [PATCH] docs(polymorphic_has_many): Update notable_type attribute Had a conversation with Rich that can be found -> (https://graphiti-api.slack.com/archives/C5A4UEMGS/p1606923424312700). Specifying the `_type` attribute of a `polymorphic_has_many` as a string_enum rather than a string will ensure that `eql` is used instead of `eq` when making database queries. This ensures that the database query does not use LOWER and bypass indexes. --- guides/concepts/resources.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/concepts/resources.md b/guides/concepts/resources.md index 5138962..d61f19e 100644 --- a/guides/concepts/resources.md +++ b/guides/concepts/resources.md @@ -1323,7 +1323,7 @@ Which means the following filters are required: {% highlight ruby %} class NoteResource < ApplicationResource attribute :notable_id, :integer, only: [:filterable] - attribute :notable_type, :string, only: [:filterable] + attribute :notable_type, :string_enum, only: [:filterable], allow: ['Employee'] # ... code ... end {% endhighlight %}