Skip to content

Commit 7286208

Browse files
authored
Fix typos in Active Record Associations guide
1 parent aa66aec commit 7286208

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

guides/source/association_basics.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ then you should use `has_one` instead.
217217

218218
When used alone, `belongs_to` produces a one-directional one-to-one
219219
relationship. Therefore each book in the above example "knows" its author, but
220-
the authors don't know about their books. To setup a [bi-directional
220+
the authors don't know about their books. To set up a [bi-directional
221221
association](#bi-directional-associations) - use `belongs_to` in combination
222222
with a `has_one` or `has_many` on the other model, in this case the Author
223223
model.
@@ -560,7 +560,7 @@ the associated object's foreign key to the same value.
560560

561561
The `build_association` method returns a new object of the associated type. This
562562
object will be instantiated from the passed attributes, and the link through
563-
this objects foreign key will be set, but the associated object will _not_ yet
563+
this object's foreign key will be set, but the associated object will _not_ yet
564564
be saved.
565565

566566
```ruby
@@ -1614,7 +1614,7 @@ Similarly, you can retrieve a collection of pictures from an instance of the
16141614
Additionally, if you have an instance of the `Picture` model, you can get its
16151615
parent via `@picture.imageable`, which could be an `Employee` or a `Product`.
16161616

1617-
To setup a polymorphic association manually you would need to declare both a
1617+
To set up a polymorphic association manually you would need to declare both a
16181618
foreign key column (`imageable_id`) and a type column (`imageable_type`) in the
16191619
model:
16201620

@@ -1884,7 +1884,7 @@ end
18841884
class Car < Vehicle
18851885
end
18861886

1887-
Car.create
1887+
Car.create(color: "Red", price: 10000)
18881888
# => #<Car kind: "Car", color: "Red", price: 10000>
18891889
```
18901890

@@ -1905,7 +1905,7 @@ class Vehicle < ApplicationRecord
19051905
self.inheritance_column = nil
19061906
end
19071907

1908-
Vehicle.create!(type: "Car")
1908+
Vehicle.create!(type: "Car", color: "Red", price: 10000)
19091909
# => #<Vehicle type: "Car", color: "Red", price: 10000>
19101910
```
19111911

@@ -1929,8 +1929,7 @@ includes all attributes of all subclasses in a single table.
19291929

19301930
A disadvantage of this approach is that it can result in table bloat, as the
19311931
table will include attributes specific to each subclass, even if they aren't
1932-
used by others. This can be solved by using [`Delegated
1933-
Types`](#delegated-types).
1932+
used by others. This can be solved by using [`Delegated Types`](#delegated-types).
19341933

19351934
Additionally, if you’re using [polymorphic
19361935
associations](#polymorphic-associations), where a model can belong to more than

0 commit comments

Comments
 (0)