Minor refactor (#1443)
* Rescue `ActiveRecord::RecordNotFound` exception instead of `StandardError` * Replace `!blank?` call with `present?`
This commit is contained in:
parent
0f8c08629b
commit
cfcc204a20
1 changed files with 2 additions and 2 deletions
|
|
@ -17,10 +17,10 @@ class UserRoleService
|
|||
def update_tag_moderators(user_ids, tag)
|
||||
users = user_ids.map do |id|
|
||||
User.find(id)
|
||||
rescue StandardError
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
tag.errors[:moderator_ids] << ": user id #{id} was not found"
|
||||
end
|
||||
return false if !tag.errors[:moderator_ids].blank?
|
||||
return false if tag.errors[:moderator_ids].present?
|
||||
# Don't have to worry about comparing old and new values.
|
||||
tag.tag_moderator_ids.each do |id|
|
||||
User.find(id).remove_role(:tag_moderator, tag)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue