Replace public_send calls.
This commit is contained in:
parent
fb6d6fce5a
commit
e7393191ee
1 changed files with 3 additions and 3 deletions
|
@ -27,12 +27,12 @@ module AtomicInternalId
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
def has_internal_id(column, scope:, init:) # rubocop:disable Naming/PredicateName
|
def has_internal_id(column, scope:, init:) # rubocop:disable Naming/PredicateName
|
||||||
before_validation(on: :create) do
|
before_validation(on: :create) do
|
||||||
if self.public_send(column).blank? # rubocop:disable GitlabSecurity/PublicSend
|
if read_attribute(column).blank?
|
||||||
scope_attrs = { scope => self.public_send(scope) } # rubocop:disable GitlabSecurity/PublicSend
|
scope_attrs = { scope => association(scope).reader }
|
||||||
usage = self.class.table_name.to_sym
|
usage = self.class.table_name.to_sym
|
||||||
|
|
||||||
new_iid = InternalId.generate_next(self, scope_attrs, usage, init)
|
new_iid = InternalId.generate_next(self, scope_attrs, usage, init)
|
||||||
self.public_send("#{column}=", new_iid) # rubocop:disable GitlabSecurity/PublicSend
|
write_attribute(column, new_iid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue