From 917fddae4e6b50cef792677cb00d80065996b2ec Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Fri, 11 Jun 2021 16:29:07 +0200 Subject: [PATCH] suite --- app/models/forum_topic.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/forum_topic.rb b/app/models/forum_topic.rb index e930507..cbfb0a0 100644 --- a/app/models/forum_topic.rb +++ b/app/models/forum_topic.rb @@ -45,7 +45,10 @@ class ForumTopic < ActiveRecord::Base end ForumUser.where(:follow_new_topics => true).each do |forum_user| - folowed_topic = forum_user.followed_topics.find_or_initialize_by_forum_topic_id(topic.id) + if folowed_topic = FolowedTopic.where(:forum_topic_id => topic.id).first + else + folowed_topic = FolowedTopic.create(:forum_topic_id => topic.id) + end folowed_topic.save