mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
[Fixes #11734]Correct Association Basics Guide on has_and_belongs_to_many[ci skip]
Done the following changes: 1. Replace uniq call in example with autosave as uniq is not supported on has_and_belongs_to_many 2. Add :readonly option to list of supported call as per [EdgeApi](http://edgeapi.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#method-i-has_and_belongs_to_many)
This commit is contained in:
parent
71f512646a
commit
e54c225b16
1 changed files with 3 additions and 2 deletions
|
@ -1944,8 +1944,8 @@ While Rails uses intelligent defaults that will work well in most situations, th
|
|||
|
||||
```ruby
|
||||
class Parts < ActiveRecord::Base
|
||||
has_and_belongs_to_many :assemblies, uniq: true,
|
||||
read_only: true
|
||||
has_and_belongs_to_many :assemblies, autosave: true,
|
||||
readonly: true
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -1957,6 +1957,7 @@ The `has_and_belongs_to_many` association supports these options:
|
|||
* `:foreign_key`
|
||||
* `:join_table`
|
||||
* `:validate`
|
||||
* `:readonly`
|
||||
|
||||
##### `:association_foreign_key`
|
||||
|
||||
|
|
Loading…
Reference in a new issue