Class: Pageflow::Review::CommentsController Private

Inherits:
ApplicationController show all
Defined in:
app/controllers/pageflow/review/comments_controller.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#createObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/pageflow/review/comments_controller.rb', line 8

def create
  entry = DraftEntry.find(params[:entry_id])
  authorize!(:read, entry.to_model)

  thread = entry.comment_threads.find(params[:comment_thread_id])
  @comment = thread.comments.build(comment_params)
  @comment.creator = current_user
  @comment.save!

  render :create, status: :created
end

#updateObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/pageflow/review/comments_controller.rb', line 20

def update
  entry = DraftEntry.find(params[:entry_id])
  authorize!(:read, entry.to_model)

  @comment = find_comment(entry)

  return head(:forbidden) unless @comment.creator == current_user

  @comment.update!(update_params.merge(edited_at: Time.current))

  render :create
end