Procházet zdrojové kódy

Fix more subtle bugs with first_or_create

master
Eugen Rochko před 8 roky
rodič
revize
580b91c387
2 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. +1
    -1
      app/services/process_interaction_service.rb
  2. +1
    -1
      app/services/process_mentions_service.rb

+ 1
- 1
app/services/process_interaction_service.rb Zobrazit soubor

@@ -62,7 +62,7 @@ class ProcessInteractionService < BaseService
end

def favourite!(xml, from_account)
status(xml).favourites.first_or_create!(account: from_account)
status(xml).favourites.where(account: from_account).first_or_create!(account: from_account)
end

def add_post!(body, account)


+ 1
- 1
app/services/process_mentions_service.rb Zobrazit soubor

@@ -14,7 +14,7 @@ class ProcessMentionsService < BaseService
mentioned_account = follow_remote_account_service.("#{match.first}")
end

mentioned_account.mentions.first_or_create(status: status)
mentioned_account.mentions.where(status: status).first_or_create(status: status)
end

status.mentions.each do |mentioned_account|


Načítá se…
Zrušit
Uložit