include~は表示順を降順にしてます。
search以降は検索機能のなのでなくていいです。
ideas.controller.rb
def index
@idea2 = Idea.where({category_id: 2}).includes(:user).order("created_at DESC").search(params[:search])
@idea3 = Idea.where({category_id: 3}).includes(:user).order("created_at DESC").search(params[:search])
@idea4 = Idea.where({category_id: 4}).includes(:user).order("created_at DESC").search(params[:search])
@idea5 = Idea.where({category_id: 5}).includes(:user).order("created_at DESC").search(params[:search])
end
index.html.rb
<div class="category bg-success">あ</div>
<% @idea2.each do |idea| %>
<%= link_to idea.title, idea_path(idea.id), class: :card__title%>
<% end %>
<div class="category bg-success">い</div>
<% @idea3.each do |idea| %>
<%= link_to idea.title, idea_path(idea.id), class: :card__title%>
<% end %>
<div class="category bg-success">う</div>
<% @idea4.each do |idea| %>
<%= link_to idea.title, idea_path(idea.id), class: :card__title%>
<% end %>
これでできました。