@@ -217,7 +217,7 @@ then you should use `has_one` instead.
217
217
218
218
When used alone, ` belongs_to ` produces a one-directional one-to-one
219
219
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
221
221
association] ( #bi-directional-associations ) - use ` belongs_to ` in combination
222
222
with a ` has_one ` or ` has_many ` on the other model, in this case the Author
223
223
model.
@@ -560,7 +560,7 @@ the associated object's foreign key to the same value.
560
560
561
561
The ` build_association ` method returns a new object of the associated type. This
562
562
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
564
564
be saved.
565
565
566
566
``` ruby
@@ -1614,7 +1614,7 @@ Similarly, you can retrieve a collection of pictures from an instance of the
1614
1614
Additionally, if you have an instance of the ` Picture ` model, you can get its
1615
1615
parent via ` @picture.imageable ` , which could be an ` Employee ` or a ` Product ` .
1616
1616
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
1618
1618
foreign key column (` imageable_id ` ) and a type column (` imageable_type ` ) in the
1619
1619
model:
1620
1620
@@ -1884,7 +1884,7 @@ end
1884
1884
class Car < Vehicle
1885
1885
end
1886
1886
1887
- Car .create
1887
+ Car .create( color: " Red " , price: 10000 )
1888
1888
# => #<Car kind: "Car", color: "Red", price: 10000>
1889
1889
```
1890
1890
@@ -1905,7 +1905,7 @@ class Vehicle < ApplicationRecord
1905
1905
self .inheritance_column = nil
1906
1906
end
1907
1907
1908
- Vehicle .create!(type: " Car" )
1908
+ Vehicle .create!(type: " Car" , color: " Red " , price: 10000 )
1909
1909
# => #<Vehicle type: "Car", color: "Red", price: 10000>
1910
1910
```
1911
1911
@@ -1929,8 +1929,7 @@ includes all attributes of all subclasses in a single table.
1929
1929
1930
1930
A disadvantage of this approach is that it can result in table bloat, as the
1931
1931
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 ) .
1934
1933
1935
1934
Additionally, if you’re using [ polymorphic
1936
1935
associations] ( #polymorphic-associations ) , where a model can belong to more than
0 commit comments