Class: Commentui::CommentsController
Instance Method Summary
collapse
#check_commentui_user, #commentui_user, #record_not_found, #render_json_errors
Instance Method Details
#create ⇒ Object
18
19
20
21
22
23
24
|
# File 'app/controllers/commentui/comments_controller.rb', line 18
def create
@comment = .new()
@comment.creator =
return render json: @comment if @comment.save
render_json_errors(@comment.errors.full_messages)
end
|
#destroy ⇒ Object
34
35
36
|
# File 'app/controllers/commentui/comments_controller.rb', line 34
def destroy
render json: @comment.destroy
end
|
#index ⇒ Object
12
13
14
15
16
|
# File 'app/controllers/commentui/comments_controller.rb', line 12
def index
@comments = .includes(:creator, :editor)
@pagy, @comments = pagy(@comments, items: params[:items])
render json: @comments
end
|
#update ⇒ Object
26
27
28
29
30
31
32
|
# File 'app/controllers/commentui/comments_controller.rb', line 26
def update
@comment.assign_attributes()
@comment.editor =
return render json: @comment if @comment.save
render_json_errors(@comment.errors.full_messages)
end
|