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