Add and apply Style/RedundantSelf rubocop rule
This commit is contained in:
@@ -43,7 +43,7 @@ class AdminNotification < ApplicationRecord
|
||||
return unless link.present?
|
||||
|
||||
unless link =~ /\A(http:\/\/|https:\/\/|\/)/
|
||||
self.link = "http://#{self.link}"
|
||||
self.link = "http://#{link}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -364,11 +364,11 @@ class Budget
|
||||
end
|
||||
|
||||
def assigned_valuators
|
||||
self.valuators.map(&:description_or_name).compact.join(", ").presence
|
||||
valuators.map(&:description_or_name).compact.join(", ").presence
|
||||
end
|
||||
|
||||
def assigned_valuation_groups
|
||||
self.valuator_groups.map(&:name).compact.join(", ").presence
|
||||
valuator_groups.map(&:name).compact.join(", ").presence
|
||||
end
|
||||
|
||||
def self.with_milestone_status_id(status_id)
|
||||
|
||||
@@ -14,8 +14,8 @@ class Budget
|
||||
include Imageable
|
||||
|
||||
belongs_to :budget, touch: true
|
||||
belongs_to :next_phase, class_name: self.name, inverse_of: :prev_phase
|
||||
has_one :prev_phase, class_name: self.name, foreign_key: :next_phase_id, inverse_of: :next_phase
|
||||
belongs_to :next_phase, class_name: name, inverse_of: :prev_phase
|
||||
has_one :prev_phase, class_name: name, foreign_key: :next_phase_id, inverse_of: :next_phase
|
||||
|
||||
validates_translation :name, presence: true
|
||||
validates_translation :description, length: { maximum: DESCRIPTION_MAX_LENGTH }
|
||||
|
||||
@@ -25,7 +25,7 @@ module Globalizable
|
||||
translated_attribute_names.any? { |attr| required_attribute?(attr) }
|
||||
end
|
||||
|
||||
if self.paranoid? && translation_class.attribute_names.include?("hidden_at")
|
||||
if paranoid? && translation_class.attribute_names.include?("hidden_at")
|
||||
translation_class.send :acts_as_paranoid, column: :hidden_at
|
||||
end
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ class LocalCensusRecord < ApplicationRecord
|
||||
private
|
||||
|
||||
def sanitize
|
||||
self.document_type = self.document_type&.strip
|
||||
self.document_number = self.document_number&.strip
|
||||
self.postal_code = self.postal_code&.strip
|
||||
self.document_type = document_type&.strip
|
||||
self.document_number = document_number&.strip
|
||||
self.postal_code = postal_code&.strip
|
||||
end
|
||||
end
|
||||
|
||||
@@ -58,6 +58,6 @@ class ProposalNotification < ApplicationRecord
|
||||
private
|
||||
|
||||
def set_author
|
||||
self.update(author_id: self.proposal.author_id) if self.proposal
|
||||
update(author_id: proposal.author_id) if proposal
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class RelatedContent < ApplicationRecord
|
||||
belongs_to :author, class_name: "User"
|
||||
belongs_to :parent_relationable, polymorphic: true, optional: false, touch: true
|
||||
belongs_to :child_relationable, polymorphic: true, optional: false, touch: true
|
||||
has_one :opposite_related_content, class_name: self.name, foreign_key: :related_content_id
|
||||
has_one :opposite_related_content, class_name: name, foreign_key: :related_content_id
|
||||
has_many :related_content_scores, dependent: :destroy
|
||||
|
||||
validates :parent_relationable_id, uniqueness: { scope: [:parent_relationable_type, :child_relationable_id, :child_relationable_type] }
|
||||
|
||||
Reference in New Issue
Block a user