Class: Storytime::CommentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Storytime::CommentsController
- Defined in:
- app/controllers/storytime/comments_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#authenticate_user!, #current_user, #setup, #user_signed_in?
Methods included from Storytime::Concerns::CurrentSite
Methods included from Storytime::Concerns::ControllerContentFor
#content_for, #content_for?, #view_context
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/storytime/comments_controller.rb', line 12 def create @comment = Comment.new(comment_params) @comment.user = current_user @comment.post = @post @comment opts = { notice: I18n.t('flash.comments.create.success') } if @comment.save redirect_to @post, opts end |
#destroy ⇒ Object
22 23 24 25 26 27 |
# File 'app/controllers/storytime/comments_controller.rb', line 22 def destroy @comment = current_user.storytime_comments.find(params[:id]) @comment @comment.destroy respond_with @comment end |