diff --git a/app/controllers/ai_tags_controller.rb b/app/controllers/ai_tags_controller.rb index b02616ba0..93dab3d92 100644 --- a/app/controllers/ai_tags_controller.rb +++ b/app/controllers/ai_tags_controller.rb @@ -10,7 +10,7 @@ class AITagsController < ApplicationController params[:search][:is_posted] ||= "true" if request.format.html? @ai_tags = authorize AITag.visible(CurrentUser.user).paginated_search(params, limit: limit, count_pages: false) - @ai_tags = @ai_tags.includes(:media_asset, :tag, :post) if request.format.html? + @ai_tags = @ai_tags.includes(:tag, media_asset: :post) if request.format.html? respond_with(@ai_tags) end diff --git a/app/models/ai_tag.rb b/app/models/ai_tag.rb index 103ca93fc..f88562648 100644 --- a/app/models/ai_tag.rb +++ b/app/models/ai_tag.rb @@ -47,12 +47,12 @@ class AITag < ApplicationRecord # True if the AI tag is present on the post; false if the AI tag is not on the post, or the asset isn't a post yet. def post_tagged? - if post.nil? + if media_asset.post.nil? false elsif tag.name =~ /\Arating:(.)\z/ - post.rating == $1 + media_asset.post.rating == $1 else - post.has_tag?(tag.name) + media_asset.post.has_tag?(tag.name) end end diff --git a/app/views/ai_tags/_preview.html.erb b/app/views/ai_tags/_preview.html.erb index e843fc092..3432c25a6 100644 --- a/app/views/ai_tags/_preview.html.erb +++ b/app/views/ai_tags/_preview.html.erb @@ -3,10 +3,11 @@