开发者

What is the equivalent of DataMapper's child_key in ActiveRecord?

开发者 https://www.devze.com 2023-03-29 07:27 出处:网络
What is the closest thing to child_key from DataMapper in ActiveRecord? How would one write this using ActiveRecord?

What is the closest thing to child_key from DataMapper in ActiveRecord? How would one write this using ActiveRecord?

   belongs_to :something, :class_name => Foo, :child_key => [:some开发者_高级运维thing_id]


From what I read here :child_key is the foreign_key. In ActiveRecord you use :foreign_key.

   belongs_to :something, :class_name => 'Foo', :foreign_key => :something_id

If I have misunderstood the purpose of child_key, please let me know.

0

精彩评论

暂无评论...
验证码 换一张
取 消