Skip to content

Commit

Permalink
code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yrudman committed Feb 21, 2019
1 parent d18afee commit 1e1aa44
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ def validate

def check_reference
present_ref = []
%w(miq_requests vms miq_widgets miq_templates).each do |model|
present_ref << model.classify unless public_send(model).first.nil?
%w(miq_requests vms miq_widgets miq_templates).each do |association|
present_ref << association.classify unless public_send(association).first.nil?
end

if present_ref.size.positive?
errors.add(:users, "reference to this user with id [#{id}] present in other models: #{present_ref.join(" ")}")
throw throw :abort
unless present_ref.empty?
errors.add(:base, "user with id [#{id}] has references to other models: #{present_ref.join(" ")}")
throw :abort
end
end

Expand Down

0 comments on commit 1e1aa44

Please sign in to comment.