阅读背景:

最简单有效的路线。rb这些模型吗?

来源:互联网 
class Topic < ActiveRecord::Base
  has_many   :posts
end

class Post < ActiveRecord::Base
  belongs_to :topic
  has_many   :comments
end

class Comment < ActiveRecord::Base
  has_ancestry
  belongs_to :post
end

MyApp::Application.routes.draw do
  resources :posts do
    resources :comments
  end
  resources :topics
  root :to => "posts#index"
end
class Topic < ActiveRecord::Base
  has_many   :



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: