diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2012-09-09 17:38:47 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2012-09-09 17:38:47 +0530 |
commit | cb524dc1d7525a26ecea8cf049757e530f0d4026 (patch) | |
tree | 3a2d8727e97c67e37a357c1cf180e9ca17cff28b /guides/source/association_basics.textile | |
parent | 6107407e66aa68cf269ec00b64d7ab3623465b97 (diff) | |
parent | 2db79dc9ea0b623c6d76b72e85f58efd63b50e08 (diff) | |
download | rails-cb524dc1d7525a26ecea8cf049757e530f0d4026.tar.gz rails-cb524dc1d7525a26ecea8cf049757e530f0d4026.tar.bz2 rails-cb524dc1d7525a26ecea8cf049757e530f0d4026.zip |
Merge branch 'master' of github.com:lifo/docrails
Conflicts:
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
Diffstat (limited to 'guides/source/association_basics.textile')
-rw-r--r-- | guides/source/association_basics.textile | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/guides/source/association_basics.textile b/guides/source/association_basics.textile index d4c0a1ba74..151752eee9 100644 --- a/guides/source/association_basics.textile +++ b/guides/source/association_basics.textile @@ -88,6 +88,8 @@ end !images/belongs_to.png(belongs_to Association Diagram)! +NOTE: +belongs_to+ associations _must_ use the singular term. If you used the pluralized form in the above example for the +customer+ association in the +Order+ model, you would be told that there was an "uninitialized constant Order::Customers". This is because Rails automatically infers the class name from the association name. If the association name is wrongly pluralized, then the inferred class will be wrongly pluralized too. + h4. The +has_one+ Association A +has_one+ association also sets up a one-to-one connection with another model, but with somewhat different semantics (and consequences). This association indicates that each instance of a model contains or possesses one instance of another model. For example, if each supplier in your application has only one account, you'd declare the supplier model like this: |