I am making an application for posting events, and I made it a specification to save categories and scales in the active hash. I was able to search for the event name in the event model column using the search function, but I cannot search for data using the active hash.

Error statement

ActiveRecord :: StatementInvalid in Events # search_event
Showing /Users/user/projects/asomemo/app/views/events/search_event.html.erb where line # 6 raised:
Mysql2 :: Error: Unknown column'category_id.name' in'where clause'
Extracted source (around line # 6):<% end%><% @ events.each do | event |%><% = render partial: "event", locals: {event: event}%><% end%>

An error occurred because there is no column for category_id.name in the event model

Target code
Event controller

class EventsController</pre>
<p>Event model</p>
<pre><code>class Event</pre>
<p>Event migration file</p>
<pre><code>class CreateEvents</pre>
<p>Search view</p>
<pre><code><% = form_with (url: search_event_events_path, local: true, method:: get, class: "search-form") do | form |%><% = form.text_field: keyword, placeholder: "Search for posts", class: "search-input"%><% = form.submit "search", class: "search-btn"%><% end%>

---------- What I went to ---------------
Change the column name to search for the event model

Event.where ('category_id LIKE (?)', "% # {Search}%")

You can search, but you can only search by id number. Therefore, the search process is described in the active hash model.

class Category

I mentioned it, but I couldn't search the category. How can I use the name data of the active hash in the searth method?