このコミットが含まれているのは:
@@ -7,21 +7,4 @@ class NicoTagRelation < ApplicationRecord
|
||||
|
||||
validates :nico_tag_id, presence: true
|
||||
validates :tag_id, presence: true
|
||||
|
||||
validate :nico_tag_must_be_nico
|
||||
validate :tag_mustnt_be_nico
|
||||
|
||||
private
|
||||
|
||||
def nico_tag_must_be_nico
|
||||
if nico_tag && nico_tag.category != 'nico'
|
||||
errors.add :nico_tag_id, 'タグのカテゴリがニコニコである必要があります.'
|
||||
end
|
||||
end
|
||||
|
||||
def tag_mustnt_be_nico
|
||||
if tag && tag.category == 'nico'
|
||||
errors.add :tag_id, '連携先タグのカテゴリはニコニコであってはなりません.'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -92,7 +92,7 @@ class Post < ApplicationRecord
|
||||
inverse_of: :parent_post
|
||||
has_many :children, through: :child_post_implications, source: :post
|
||||
|
||||
has_many :post_external_tags, dependent: :delete_all
|
||||
has_many :post_external_tags, dependent: :destroy
|
||||
has_many :external_tags, through: :post_external_tags
|
||||
|
||||
has_one_attached :thumbnail
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class PostExternalTag < ApplicationRecord
|
||||
belongs_to :post
|
||||
belongs_to :external_tag
|
||||
belongs_to :external_tag, counter_cache: :post_count
|
||||
end
|
||||
|
||||
@@ -30,7 +30,7 @@ class Tag < ApplicationRecord
|
||||
|
||||
has_many :reversed_nico_tag_relations,
|
||||
class_name: 'NicoTagRelation',
|
||||
foreign_key: :nico_tag_id,
|
||||
foreign_key: :tag_id,
|
||||
dependent: :destroy
|
||||
has_many :linked_nico_tags, through: :reversed_nico_tag_relations, source: :nico_tag
|
||||
|
||||
@@ -71,8 +71,6 @@ class Tag < ApplicationRecord
|
||||
validate :tag_name_must_be_canonical
|
||||
validate :category_must_be_deerjikist_with_deerjikists
|
||||
|
||||
def self.nico_tags = ExternalTag.where(platform: :nico)
|
||||
|
||||
CATEGORY_PREFIXES = {
|
||||
'general:' => :general,
|
||||
'gen:' => :general,
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする