Sha256: 6525f5b7401a9c5575553520ccba38279294c81d35c1be138bad658808e9c0e4
Contents?: true
Size: 669 Bytes
Versions: 7
Compression:
Stored size: 669 Bytes
Contents
# frozen_string_literal: true module Thredded class PostPreviewsController < Thredded::ApplicationController include Thredded::RenderPreview # Preview a new post def preview @post = Post.new(post_params) @post.postable = Topic.friendly_find!(params[:topic_id]) render_preview end # Preview an update to an existing post def update @post = Post.find(params[:post_id]) @post.assign_attributes(post_params) render_preview end private def post_params params.require(:post) .permit(:content) .merge(user: thredded_current_user, messageboard: messageboard) end end end
Version data entries
7 entries across 7 versions & 1 rubygems