Handle missing services in share worker
This commit is contained in:
parent
45ceb27795
commit
5d6f9deb93
|
@ -9,7 +9,7 @@ class ShareWorker
|
||||||
# @param answer_id [Integer] the user id
|
# @param answer_id [Integer] the user id
|
||||||
# @param service [String] the service to post to
|
# @param service [String] the service to post to
|
||||||
def perform(user_id, answer_id, service) # rubocop:disable Metrics/AbcSize
|
def perform(user_id, answer_id, service) # rubocop:disable Metrics/AbcSize
|
||||||
@user_service = User.find(user_id).services.find_by(type: "Services::#{service.camelize}")
|
@user_service = User.find(user_id).services.find_by!(type: "Services::#{service.camelize}")
|
||||||
|
|
||||||
@user_service.post(Answer.find(answer_id))
|
@user_service.post(Answer.find(answer_id))
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
|
Loading…
Reference in New Issue