mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
ApplicationRecord
instead of ActiveRecord::Base
in Association Guides [ci skip]
This commit is contained in:
parent
be3d4c6ef6
commit
b4803e6ea7
1 changed files with 2 additions and 2 deletions
|
@ -19,10 +19,10 @@ Why Associations?
|
|||
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 Author < ActiveRecord::Base
|
||||
class Author < ApplicationRecord
|
||||
end
|
||||
|
||||
class Book < ActiveRecord::Base
|
||||
class Book < ApplicationRecord
|
||||
end
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue