我一直在关注有关在此处创建和安装引擎的 Rails 指南。创建的博客文章当我尝试发表评论时,它返回“ActiveModel::ForbiddenAttributesError in Blorgh::CommentsController#create”错误。评论控制器
require_dependency "blorgh/application_controller"
module Blorgh
class CommentsController < ApplicationController
def create
@post = Post.find(params[:post_id])
@comment = @post.comments.create(params[:comment])
flash[:notice] = "Comment has been created!"
redirect_to posts_path
end
end
end
这是评论模型
module Blorgh
class Comment < ActiveRecord::Base
end
end
如何解决问题?