Project

General

Profile

« Previous | Next » 

Revision d7c67746

Added by Michael Moll almost 6 years ago

Fixes #19873 - Fix Style/MultilineIfModifier cop (#5705)

  • Refs #20891 - fix for new rubocop rules
  • Fixes #19873 - Fix Style/MultilineIfModifier cop

View differences:

app/models/concerns/has_many_common.rb
# SETTER _name= method
define_method "#{assoc_name}=" do |name_value|
assoc_id = assoc_klass(association).send("find_by_#{assoc_klass(association).attribute_name}", name_value).try(:id)
raise Foreman::AssociationNotFound
.new(_("Could not find %{association} with name: %{name}") % { name: name_value, association: association }) unless assoc_id
unless assoc_id
raise Foreman::AssociationNotFound
.new(_("Could not find %{association} with name: %{name}") % { name: name_value, association: association })
end
self.send("#{assoc}_id=", assoc_id)
end

Also available in: Unified diff