Class: Thredded::PrivatePostPreviewsController

Inherits:
ApplicationController show all
Includes:
RenderPreview
Defined in:
app/controllers/thredded/private_post_previews_controller.rb

Instance Method Summary collapse

Methods included from UrlsHelper

#delete_post_path, #edit_post_path, #edit_preferences_path, #edit_preferences_url, #mark_unread_path, #permalink_path, #post_path, #post_url, #quote_post_path, #search_path, #topic_path, #topic_url, #user_path

Instance Method Details

#previewObject

Preview a new post



8
9
10
11
12
# File 'app/controllers/thredded/private_post_previews_controller.rb', line 8

def preview
  @private_post = Thredded::PrivatePost.new(private_post_params)
  @private_post.postable = Thredded::PrivateTopic.friendly_find!(params[:private_topic_id])
  render_preview
end

#updateObject

Preview an update to an existing post



15
16
17
18
19
# File 'app/controllers/thredded/private_post_previews_controller.rb', line 15

def update
  @private_post = Thredded::PrivatePost.find(params[:private_post_id])
  @private_post.assign_attributes(private_post_params)
  render_preview
end