Post#copy_notes_to: wrap in transaction.
This commit is contained in:
@@ -1415,6 +1415,7 @@ class Post < ApplicationRecord
|
||||
end
|
||||
|
||||
def copy_notes_to(other_post)
|
||||
transaction do
|
||||
if id == other_post.id
|
||||
errors.add :base, "Source and destination posts are the same"
|
||||
return false
|
||||
@@ -1440,6 +1441,7 @@ class Post < ApplicationRecord
|
||||
dummy.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ApiMethods
|
||||
def hidden_attributes
|
||||
|
||||
Reference in New Issue
Block a user