
关系: article 和 comment 分析.md
1.0
这个最简单,两张表:
article has_many comments
comment belongs_to article
2.0
rails generate model Article title:string text:text
rails generate model Comment commenter:string body:text article:references
1 |
class CreateArticles < ActiveRecord::Migration |
1 |
class CreateComments < ActiveRecord::Migration |
1 |
class Comment < ActiveRecord::Base |
1 |
resources :articles do |
1 |
class Article < ActiveRecord::Base |




近期评论