Sha256: a5d0af4231fbc7d3eacacafde9d429f738b6076e00d09ee2bad3b514a4accbf3
Contents?: true
Size: 701 Bytes
Versions: 4
Compression:
Stored size: 701 Bytes
Contents
# frozen_string_literal: true module Thredded class PostPreviewsController < Thredded::ApplicationController include Thredded::RenderPreview # Preview a new post def preview @post = Thredded::Post.new(post_params) @post.postable = Thredded::Topic.friendly_find!(params[:topic_id]) render_preview end # Preview an update to an existing post def update @post = Thredded::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
4 entries across 4 versions & 1 rubygems