Added examples to use class_name options for association.

This commit is contained in:
Abhay Nikam 2018-06-07 09:58:48 +05:30
parent 41f2e11c4d
commit f3b202746b

View File

@ -81,6 +81,7 @@ e.g.
```ruby
has_one :bio
has_one :blog, key: :site
has_one :blog, class_name: "Blog"
has_one :maker, virtual_value: { id: 1 }
has_one :blog do |serializer|
@ -114,6 +115,7 @@ e.g.
has_many :comments
has_many :comments, key: :reviews
has_many :comments, serializer: CommentPreviewSerializer
has_many :comments, class_name: "Comment"
has_many :reviews, virtual_value: [{ id: 1 }, { id: 2 }]
has_many :comments, key: :last_comments do
last(1)
@ -127,6 +129,7 @@ e.g.
```ruby
belongs_to :author, serializer: AuthorPreviewSerializer
belongs_to :author, key: :writer
belongs_to :author, class_name: "Author"
belongs_to :post
belongs_to :blog
def blog