aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2015-11-05 16:01:19 -0500
committerYves Senn <yves.senn@gmail.com>2015-11-05 16:01:19 -0500
commit9b663e2679cfdaa2da9bfed0bd4d601309072c22 (patch)
tree8840867701c7ff0016da6bcdcbca9a0214dcfd8c /guides
parente262b2d01ccf26deb2345665a748548c7c18a8c1 (diff)
parentaaddae48e2d2e5e160aeb3e4bf72fd19d2cca278 (diff)
downloadrails-9b663e2679cfdaa2da9bfed0bd4d601309072c22.tar.gz
rails-9b663e2679cfdaa2da9bfed0bd4d601309072c22.tar.bz2
rails-9b663e2679cfdaa2da9bfed0bd4d601309072c22.zip
Merge pull request #22150 from raq929/patch-1
Update association_basics.md [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/association_basics.md6
1 files changed, 4 insertions, 2 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index 74cd9bdc7b..996050d667 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -16,7 +16,7 @@ After reading this guide, you will know:
Why Associations?
-----------------
-Why do we need associations between models? Because they make common operations simpler and easier in your code. For example, consider a simple Rails application that includes a model for customers and a model for orders. Each customer can have many orders. Without associations, the model declarations would look like this:
+In Rails, an _association_ is a connection between two Active Record models. Why do we need associations between models? Because they make common operations simpler and easier in your code. For example, consider a simple Rails application that includes a model for customers and a model for orders. Each customer can have many orders. Without associations, the model declarations would look like this:
```ruby
class Customer < ActiveRecord::Base
@@ -71,7 +71,7 @@ To learn more about the different types of associations, read the next section o
The Types of Associations
-------------------------
-In Rails, an _association_ is a connection between two Active Record models. Associations are implemented using macro-style calls, so that you can declaratively add features to your models. For example, by declaring that one model `belongs_to` another, you instruct Rails to maintain Primary Key-Foreign Key information between instances of the two models, and you also get a number of utility methods added to your model. Rails supports six types of associations:
+Rails supports six types of associations:
* `belongs_to`
* `has_one`
@@ -80,6 +80,8 @@ In Rails, an _association_ is a connection between two Active Record models. Ass
* `has_one :through`
* `has_and_belongs_to_many`
+Associations are implemented using macro-style calls, so that you can declaratively add features to your models. For example, by declaring that one model `belongs_to` another, you instruct Rails to maintain [Primary Key](https://en.wikipedia.org/wiki/Unique_key)-[Foreign Key](https://en.wikipedia.org/wiki/Foreign_key) information between instances of the two models, and you also get a number of utility methods added to your model.
+
In the remainder of this guide, you'll learn how to declare and use the various forms of associations. But first, a quick introduction to the situations where each association type is appropriate.
### The `belongs_to` Association