Class: CommentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- CommentsController
- Defined in:
- app/controllers/comments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/comments_controller.rb', line 9 def create @comment.user_id = current_user.id @comment.date_created = DateTime.now if @comment.save respond_with @comment do |format| format.html { redirect_to resource } end end end |
#destroy ⇒ Object
19 20 21 22 23 24 |
# File 'app/controllers/comments_controller.rb', line 19 def destroy @comment.destroy respond_with @comment do |format| format.html { redirect_to resource } end end |
#resource ⇒ Object
26 27 28 |
# File 'app/controllers/comments_controller.rb', line 26 def resource @resource ||= @comment.resource end |