我有模型post.rb:
class Post
include Mongoid::Document
attr_accessible :content, :original_post
end
在posts_controller.rb中创建操作:
def create
@post = Post.new(params[:post])
@post.original_post = @post
@post.save
end
我想知道这篇文章是原创的,因为我会复制这篇文章,并且我会有更多具有相同功能的帖子。
但是,当我尝试创建帖子时,出现错误:
BSON::InvalidDocument(不能将 Post 类的对象序列化为 BSON。):