提交 949deedf 编写于 作者: P Peter Marsh

Clarify the documentation of the primary_key option for associations

Previously the documentation stated that `primary_key` should be the name of
a *method* that returns the primary key used for the association. This is
incorrect. This changes the documentation to say that the value must be the
name of a column.
上级 f4595e62
...@@ -1171,7 +1171,7 @@ module ClassMethods ...@@ -1171,7 +1171,7 @@ module ClassMethods
# of this class in lower-case and "_id" suffixed. So a Person class that makes a +has_many+ # of this class in lower-case and "_id" suffixed. So a Person class that makes a +has_many+
# association will use "person_id" as the default <tt>:foreign_key</tt>. # association will use "person_id" as the default <tt>:foreign_key</tt>.
# [:primary_key] # [:primary_key]
# Specify the method that returns the primary key used for the association. By default this is +id+. # Specify the name of the column to use as the primary key for the association. By default this is +id+.
# [:dependent] # [:dependent]
# Controls what happens to the associated objects when # Controls what happens to the associated objects when
# their owner is destroyed. Note that these are implemented as # their owner is destroyed. Note that these are implemented as
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册