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
= .new()
.creator =
return render json: if .save
render_json_errors(.errors.full_messages)
end
|
#destroy ⇒ Object
34
35
36
|
# File 'app/controllers/commentui/comments_controller.rb', line 34
def destroy
render json: .destroy
end
|
#index ⇒ Object
12
13
14
15
16
|
# File 'app/controllers/commentui/comments_controller.rb', line 12
def index
= .includes(:creator, :editor)
@pagy, = pagy(, items: params[:items])
render json:
end
|
#update ⇒ Object
26
27
28
29
30
31
32
|
# File 'app/controllers/commentui/comments_controller.rb', line 26
def update
.assign_attributes()
.editor =
return render json: if .save
render_json_errors(.errors.full_messages)
end
|