Browse Source

Use find_or_initialize_by (#9504)

master
ysksn 6 years ago
committed by Eugen Rochko
parent
commit
351ed12b2f
1 changed files with 1 additions and 6 deletions
  1. +1
    -6
      app/services/pubsubhubbub/subscribe_service.rb

+ 1
- 6
app/services/pubsubhubbub/subscribe_service.rb View File

@ -58,12 +58,7 @@ class Pubsubhubbub::SubscribeService < BaseService
end end
def locate_subscription 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.domain = domain
subscription.save! subscription.save!
subscription subscription

Loading…
Cancel
Save