Prefer `update!` -> `update!`.
This commit is contained in:
parent
6597cc4cd0
commit
50f14c6e61
|
@ -167,7 +167,7 @@ class PostDestroyer
|
|||
def make_previous_post_the_last_one
|
||||
last_post = Post.where("topic_id = ? and id <> ?", @post.topic_id, @post.id).order('created_at desc').limit(1).first
|
||||
if last_post.present?
|
||||
@post.topic.update_attributes(
|
||||
@post.topic.update!(
|
||||
last_posted_at: last_post.created_at,
|
||||
last_post_user_id: last_post.user_id,
|
||||
highest_post_number: last_post.post_number
|
||||
|
|
Loading…
Reference in New Issue