Rails belongs_to,has_one,has_many,has_and_belongs_to_many 求讲解

Unknow user · November 30, 2011 · Last by jhjguxin replied at February 04, 2012 · 8686 hits
belongs_to              
has_one                
has_many                
has_and_belongs_to_many

http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html 这个我看了,但是英文不行,琢磨了很久没明白。 求讲解,求翻译。

belongs_to  # 一对多,与 has_many,has_one 套用        
has_one      # 一对一          
has_many   # 一对多的另外一方            
has_and_belongs_to_many # 多对多

@KennX 如果在英文上感觉很受挫的话,一时半会也无法改善,那么就看这个吧:http://ihower.tw/rails3/activerecord-relationships.html

感觉英文还是得看,中文的资料太老太少,包括解决问题也很少有到中文网站去搜索方案,倒是国外得 stackoverflow 等比较全面...我也是 rails 初学者,好在英语读着不是那么难受,读多了能好一些,适应不少。现在是将近第三个月了.渐渐觉得习惯了..一起加油吧!

model 里最常用的方法

@Guest 我的 blog 里面翻译了一些 Rails 的 guide 文档 可以参考一下 英文不行但是基本的英语能力总要的呀

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