Class: Batches::CommentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Batches::CommentsController
- Defined in:
- app/controllers/batches/comments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 |
# File 'app/controllers/batches/comments_controller.rb', line 12 def create @batch.comments.create(description: params[:comment], user_id: current_user.id) @comments = @batch.comments render partial: 'list', locals: { commentable: @batch, visible: true } end |
#destroy ⇒ Object
18 19 20 21 22 23 |
# File 'app/controllers/batches/comments_controller.rb', line 18 def destroy comment = Comment.find(params[:id]) comment.destroy if comment.present? @comments = @batch.comments render partial: 'list', locals: { commentable: @batch, visible: true } end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/batches/comments_controller.rb', line 8 def index @comments = @batch.comments.order(created_at: :asc) end |