Class: CommentsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/comments_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#fresh_when, #redirect_back_or_default, #redirect_referrer_or_default, #render_403, #render_404, #render_optional_error_file, #require_user, #set_active_menu, #set_locale, #set_seo_meta, #store_location, #unread_notify_count

Instance Method Details

#comment_paramsObject


10
11
12
# File 'app/controllers/comments_controller.rb', line 10

def comment_params
  params.require(:comment).permit(:commentable_type, :commentable_id, :body)
end

#createObject


4
5
6
7
8
# File 'app/controllers/comments_controller.rb', line 4

def create
  @comment = Comment.new(comment_params)
  @comment.user = current_user
  @success = @comment.save
end