【发布时间】:2013-01-13 02:25:20
【问题描述】:
我有一个用 ruby on rails 创建的简单博客,我的模型包括 帖子,类别和分类。也就是帖子通过分类属于很多类别
post.rb
class Post < ActiveRecord::Base
has_many :categorizations
has_many :categories, through: :categorizations
attr_accessible :author, :description, :title, :photo, :category_ids
end
category.rb
class Category < ActiveRecord::Base
attr_accessible :name
has_many :categorizations
has_many :posts, :through => :categorizations
end
分类.rb
class Categorization < ActiveRecord::Base
attr_accessible :category_id, :position, :post_id
belongs_to :post
belongs_to :category
end
应用程序中没有用户模型 我希望能够在帖子模型中添加 facebook 评论,以便访问我的应用程序的任何人都可以对任何帖子发表评论,而且我还可以计算出最高 facebook 评论的帖子,以便我可以利用它
【问题讨论】:
标签: ruby-on-rails facebook comments