Class: CommentsController

Inherits:
InternalController
  • Object
show all
Defined in:
lib/generators/comments/templates/controllers/comments_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
# File 'lib/generators/comments/templates/controllers/comments_controller.rb', line 8

def create
  comment.save ? head(:ok) : head(:unprocessable_entity)
end

#destroyObject



12
13
14
# File 'lib/generators/comments/templates/controllers/comments_controller.rb', line 12

def destroy
  comment.destroy ? head(:ok) : head(:unprocessable_entity)
end

#indexObject



4
5
6
# File 'lib/generators/comments/templates/controllers/comments_controller.rb', line 4

def index
  Comment.all
end