みてるぞ 2 days ago
parent
commit
d8fd7ca124
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      backend/app/controllers/thread_posts_controller.rb

+ 3
- 0
backend/app/controllers/thread_posts_controller.rb View File

@@ -24,6 +24,9 @@ class ThreadPostsController < ApplicationController
def create def create
post = @thread.posts.new(post_params) post = @thread.posts.new(post_params)
if post.save if post.save
post.thread.tap { |thread|
thread.updated_at = post.created_at
}.save!
render json: post.as_json.merge(image_url: ( render json: post.as_json.merge(image_url: (
if post.image.attached? if post.image.attached?
Rails.application.routes.url_helpers.rails_blob_url(post.image, only_path: true) Rails.application.routes.url_helpers.rails_blob_url(post.image, only_path: true)


Loading…
Cancel
Save