Skip to content

Commit

Permalink
AO3-6626 correct rubocop violations
Browse files Browse the repository at this point in the history
  • Loading branch information
nikobee committed Nov 19, 2023
1 parent b16b718 commit 250b48f
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions app/models/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def commentable_owners
end

has_many :mergers, foreign_key: 'merger_id', class_name: 'Tag'
belongs_to :merger, class_name: 'Tag'
belongs_to :merger, class_name: "Tag"
belongs_to :fandom
belongs_to :media
belongs_to :last_wrangler, polymorphic: true
Expand Down Expand Up @@ -161,17 +161,18 @@ def commentable_owners
has_many :tag_set_associations, dependent: :destroy
has_many :parent_tag_set_associations, class_name: 'TagSetAssociation', foreign_key: 'parent_tag_id', dependent: :destroy

validates_presence_of :name
validates :name, presence: true
validates :name, uniqueness: true
validates_length_of :name, minimum: 1, message: "cannot be blank."
validates_length_of :name,
maximum: ArchiveConfig.TAG_MAX,
message: "^Tag name '%{value}' is too long -- try using less than %{count} characters or using commas to separate your tags."
validates_format_of :name,
with: /\A[^,,、*<>^{}=`\\%]+\z/,
message: "^Tag name '%{value}' cannot include the following restricted characters: , &#94; * < > { } = ` , 、 \\ %"

validates_presence_of :sortable_name
validates :name,
length: { minimum: 1,
message: "cannot be blank." }
validates :name,
length: { maximum: ArchiveConfig.TAG_MAX,
message: "^Tag name '%{value}' is too long -- try using less than %{count} characters or using commas to separate your tags." }
validates :name,
format: { with: /\A[^,,、*<>^{}=`\\%]+\z/,
message: "^Tag name '%{value}' cannot include the following restricted characters: , &#94; * < > { } = ` , 、 \\ %" }
validates :sortable_name, presence: true

validate :unwrangleable_status
def unwrangleable_status
Expand Down

0 comments on commit 250b48f

Please sign in to comment.