Sha256: 76c1a754ee144cde94598839bab60ef2946dab045e215c405eb13dd21ad3ad0b
Contents?: true
Size: 845 Bytes
Versions: 17
Compression:
Stored size: 845 Bytes
Contents
# frozen_string_literal: true module Thredded class PostPreviewsController < Thredded::ApplicationController include Thredded::RenderPreview before_action :thredded_require_login! after_action :verify_authorized # Preview a new post def preview @post = Thredded::Post.new(post_params) @post.postable = Thredded::Topic.friendly_find!(params[:topic_id]) authorize @post, :create? render_preview end # Preview an update to an existing post def update @post = Thredded::Post.find!(params[:post_id]) authorize @post, :update? @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
17 entries across 17 versions & 1 rubygems