UnderReview/已发布用户内容模型
我正在构建一个用户生成的网站,但希望能够对其进行审核。我还需要帖子有一个静态 ID,因为我想使用 facebook 社交插件。我最初考虑的是有两个不同的表“审查”和“发布”,并将帖子从一个表移动到另一个表。但是,我不知道如何让它们保留它们的id,因为使用了表的增量id?
我也可以使用一个表并具有已发布的属性,但我觉得这个解决方案并不是真正有效,但保留 id 的唯一方法是什么?
顺便说一句,我正在使用 Rails
I am building a user-generated website, but want to be able to moderate them. I also need the posts have a static id, because I want to use the facebook social plugins. I was initially thinking about having two distinct tables 'review' and 'published' and move the posts from one table to another. However, I didnt know how make them retain their id, as the incremental id of the table is used?
I could also use one table and have a published attribute, but I feel this solution is not really performant, but the only way to preserve the id?
btw, i am using rails
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不在
posts
表中添加一个state
列来显示帖子是否已被审核或发布?如果你想变得更奇特,你可以使用类似 aasm gem 的东西。Why not have a
state
column in theposts
table to show if a post is reviewed or published? If you want to get fancy you can use something like the aasm gem.