about summary refs log tree commit diff
path: root/app/services/pubsubhubbub/subscribe_service.rb
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2018-12-12 13:54:09 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-12-12 05:54:09 +0100
commit351ed12b2f0314f7dd6c31ef018d84ca2e48ad04 (patch)
treeb636a4e2bbdf3d9649505a0e07f064f3235741df /app/services/pubsubhubbub/subscribe_service.rb
parentcf6ee4ff243b66b2b53faaceed1266999b84c3c1 (diff)
Use find_or_initialize_by (#9504)
Diffstat (limited to 'app/services/pubsubhubbub/subscribe_service.rb')
-rw-r--r--app/services/pubsubhubbub/subscribe_service.rb7
1 files changed, 1 insertions, 6 deletions
diff --git a/app/services/pubsubhubbub/subscribe_service.rb b/app/services/pubsubhubbub/subscribe_service.rb
index 2dba05b12..d2b85b85b 100644
--- a/app/services/pubsubhubbub/subscribe_service.rb
+++ b/app/services/pubsubhubbub/subscribe_service.rb
@@ -58,12 +58,7 @@ class Pubsubhubbub::SubscribeService < BaseService
   end
 
   def locate_subscription
-    subscription = Subscription.find_by(account: account, callback_url: callback)
-
-    if subscription.nil?
-      subscription = Subscription.new(account: account, callback_url: callback)
-    end
-
+    subscription = Subscription.find_or_initialize_by(account: account, callback_url: callback)
     subscription.domain = domain
     subscription.save!
     subscription