Sha256: fc2bb22a602bd1509aa0704435869ae8094d72e1d6ad56bcd5fa901d3fab289a
Contents?: true
Size: 462 Bytes
Versions: 5
Compression:
Stored size: 462 Bytes
Contents
class CommentsController < ApplicationController def create @article = Article.find(article_params["article_id"]) @comment = @article.comments.new(comment_params) @comment.save! redirect_to controller: 'articles', action: 'show', article_id: @article end private def article_params params.require(:comment).permit(:article_id) end def comment_params params.require(:comment).permit(:body, :article_id, :user_id) end end
Version data entries
5 entries across 5 versions & 1 rubygems