diff options
author | mhutchin <mike@mhutchinson.com> | 2011-10-08 23:02:33 -0700 |
---|---|---|
committer | mhutchin <mike@mhutchinson.com> | 2011-10-08 23:02:33 -0700 |
commit | ac8555b5a0f52d02b66d2074672d287db0bb91dc (patch) | |
tree | b63ac7ada34184e1a38b4b49221b33fee50bf7c7 /railties | |
parent | 3deb35ea5c92d576b3979e39f816e83d76355836 (diff) | |
download | rails-ac8555b5a0f52d02b66d2074672d287db0bb91dc.tar.gz rails-ac8555b5a0f52d02b66d2074672d287db0bb91dc.tar.bz2 rails-ac8555b5a0f52d02b66d2074672d287db0bb91dc.zip |
copy editing
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/source/association_basics.textile | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile index 5e8610073b..06cb199fd9 100644 --- a/railties/guides/source/association_basics.textile +++ b/railties/guides/source/association_basics.textile @@ -211,7 +211,7 @@ end h4. Choosing Between +belongs_to+ and +has_one+ -If you want to set up a 1–1 relationship between two models, you'll need to add +belongs_to+ to one, and +has_one+ to the other. How do you know which is which? +If you want to set up a one-to-one relationship between two models, you'll need to add +belongs_to+ to one, and +has_one+ to the other. How do you know which is which? The distinction is in where you place the foreign key (it goes on the table for the class declaring the +belongs_to+ association), but you should give some thought to the actual meaning of the data as well. The +has_one+ relationship says that one of something is yours - that is, that something points back to you. For example, it makes more sense to say that a supplier owns an account than that an account owns a supplier. This suggests that the correct relationships are like this: @@ -576,7 +576,7 @@ The <tt>create_<em>association</em></tt> method returns a new object of the asso h5. Options for +belongs_to+ -In many situations, you can use the default behavior of +belongs_to+ without any customization. But despite Rails' emphasis of convention over customization, you can alter that behavior in a number of ways. This section covers the options that you can pass when you create a +belongs_to+ association. For example, an association with several options might look like this: +In many situations, you can use the default behavior of +belongs_to+ without any customization. But despite Rails' emphasis of convention over configuration, you can alter that behavior in a number of ways. This section covers the options that you can pass when you create a +belongs_to+ association. For example, an association with several options might look like this: <ruby> class Order < ActiveRecord::Base @@ -842,7 +842,7 @@ The <tt>create_<em>association</em></tt> method returns a new object of the asso h5. Options for +has_one+ -In many situations, you can use the default behavior of +has_one+ without any customization. But despite Rails' emphasis of convention over customization, you can alter that behavior in a number of ways. This section covers the options that you can pass when you create a +has_one+ association. For example, an association with several options might look like this: +In many situations, you can use the default behavior of +has_one+ without any customization. But despite Rails' emphasis of convention over configuration, you can alter that behavior in a number of ways. This section covers the options that you can pass when you create a +has_one+ association. For example, an association with several options might look like this: <ruby> class Supplier < ActiveRecord::Base |