Rails 问个关于 dependent 和 through 的问题

metal · January 12, 2012 · Last by jhjguxin replied at February 04, 2012 · 2440 hits
class List < ActiveRecord::Base
  has_many :tasks , :dependent => :destroy
end

这样是不是意味着我删除一个 list,也会把 task 的内容删除?我也见过:destroy_all 这样的。挺茫然的。

class User < ActiveRecord::Base  
  has_many  :roles, :through => :user_roles  
end  

这个 through 我不知道有什么用

@metal 不清楚就用个用例 实际跑一下 即便是别人告诉你了 也记不住 我 blog 里面翻译了一部分的 rails guide search 一下吧

You need to Sign in before reply, if you don't have an account, please Sign up first.