evazion
2022-06-26 16:01:01 -05:00
parent efe0e8a6bd
commit 6f24db92e5
3 changed files with 10 additions and 1 deletions

View File

@@ -50,4 +50,8 @@ class AITag < ApplicationRecord
post.has_tag?(tag.name) post.has_tag?(tag.name)
end end
end end
def self.available_includes
%i[media_asset post tag]
end
end end

View File

@@ -388,4 +388,8 @@ class MediaAsset < ApplicationRecord
def initialize_file_key def initialize_file_key
self.file_key = MediaAsset.generate_file_key self.file_key = MediaAsset.generate_file_key
end end
def self.available_includes
%i[post media_metadata pixiv_ugoira_frame_data ai_tags]
end
end end

View File

@@ -69,6 +69,7 @@ class Post < ApplicationRecord
has_many :disapprovals, :class_name => "PostDisapproval", :dependent => :destroy has_many :disapprovals, :class_name => "PostDisapproval", :dependent => :destroy
has_many :favorites, dependent: :destroy has_many :favorites, dependent: :destroy
has_many :replacements, class_name: "PostReplacement", :dependent => :destroy has_many :replacements, class_name: "PostReplacement", :dependent => :destroy
has_many :ai_tags, through: :media_asset
attr_accessor :old_tag_string, :old_parent_id, :old_source, :old_rating, :has_constraints, :disable_versioning, :post_edit attr_accessor :old_tag_string, :old_parent_id, :old_source, :old_rating, :has_constraints, :disable_versioning, :post_edit
@@ -1639,7 +1640,7 @@ class Post < ApplicationRecord
%i[ %i[
uploader approver flags appeals parent children notes uploader approver flags appeals parent children notes
comments approvals disapprovals replacements pixiv_ugoira_frame_data comments approvals disapprovals replacements pixiv_ugoira_frame_data
artist_commentary artist_commentary media_asset ai_tags
] ]
end end
end end