| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
(#28078)
This PR addresses the issue described in #28025. On `dependent: :nullify` strategy only the foreign key of the relation is nullified. However on polymorphic associations the `*_type` column is not nullified leaving the record with a NULL `*_id` but the `*_type` column is present.
|
| |
|
| |
|
|
|
| |
This example was just missing a closing curly brace to complete the closure 😄
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Update association_basics.md [ci skip]
Addresses issue #33599
* Update associations.rb API documentation [ci skip]
Additional detail for documentation of `belongs_to` `association=(associate)`
* Update association_basics.md [ci skip]
Reverts misplaced documentation comment
|
|
|
|
|
| |
The examples with `.where` uses hash w/ symbol keys so it would be more consistent to also do this with `.new`.
Also from my experience the hash w/ symbol keys is more widely used with `where/new/create` etc. in ActiveRecord.
|
|
|
|
|
| |
* Singular associations don't define `#association.nil?`
* Wrap with <tt> for each method, not the whole sentence
|
|
|
|
|
| |
This commit fixes all references in the codebase missing a trailing :,
which causes the nodoc not to actually work :) [skip ci]
|
|
|
|
|
|
|
|
| |
options, and is needed for bi-directionality with a scope
[ci skip] Remove :conditions opion from association basics guide
This got replaced by scopes.
|
|
|
|
|
|
| |
* `HasManyThroughCantDissociateNewRecords` and `HasManyThroughCantAssociateNewRecords`
are no longer used since f6b12c1.
* `ReadOnlyAssociation` is no longer used since 0da426b.
|
|
|
|
|
|
| |
Replace the primary key type `integer` in docs with `bigint`.
ref #26266
|
| |
|
| |
|
|
|
|
| |
This basically reverts 9d4f79d3d394edb74fa2192e5d9ad7b09ce50c6d
|
|
|
|
|
| |
Passing `true` to force an association to reload its records from the
database was deprecated in 5.0 and removed in 5.1.
|
|
|
|
| |
`options` is never assigned to `scope` as long as using splat hash.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
We were expecting those classes to be loaded when an association is
defined but they are not.
If you add a debugger on the first line of any of those classes and try
to define the corresponding association you will see that the classes
are not loaded.
Fixes #26273
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
The object inside the scope is of the class that define the association
not the associated class.
[ci skip]
|
|
|
|
| |
[ci skip]
|
|
|
|
|
|
|
|
|
|
|
| |
Use it to specify that an association should be initialized with a
particular record before validation. For example:
# Before
belongs_to :account
before_validation -> { self.account ||= Current.account }
# After
belongs_to :account, default: -> { Current.account }
|
|
|
|
|
| |
Passing a class to `has_and_belongs_to_many` show deprecation message
three times. It is enough only once.
|
|
|
|
| |
Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
|
|
|
|
|
|
|
| |
https://github.com/rails/rails/issues/26834
This change raises an error if a has_many through association
is defined before the through association.
|
|
|
|
|
| |
Trim some needless words off the lines and format the code
sample like we'd write in the Rails source.
|
|
|
|
|
| |
Marked as private in 2afe5a1 and doesn't seem worth it
to mention the module name here.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When `ActiveRecord::Associations.eager_load!` is called, it eager loads
the `Preloader` but does not trigger a `eager_load!` on the `Preloader`
itself. A eager loaded component is responsible to forward the
`eager_load!` call to nested constants that make use of `eager_autoload`
as well.
This will also resolve the occasional `NameError` that we've observed in
production:
```
NameError: uninitialized constant ActiveRecord::Associations::Preloader::BelongsTo
```
|
|
|
|
|
|
| |
Mainly around `nil`
[ci skip]
|
|
|
|
|
|
| |
All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772.
But comments was still kept absolute position. This commit aligns
comments with method definitions for consistency.
|
|
|
|
|
|
| |
All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772.
But heredocs was still kept absolute position. This commit aligns
heredocs indentation for consistency.
|
|
|
|
| |
For simplicity.
|
|
|
|
|
|
|
|
|
| |
This is to close #26111
Developers need to be aware that `dependent: :destroy` on a scoped
`has_many` association would only destroy the associated objects in
that scope. Potentially leaving other associated objects outside that
scope untouched.
|
| |
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
| |
|
|
|
|
|
|
| |
Add a missing capital letter and avoid using absolute links to the
API because they may refer to out-dated documentation on the Edge
site.
|
|\
| |
| | |
Requesting documentation update
|
| |
| |
| |
| |
| |
| |
| |
| | |
Update associations.rb
Update associations.rb
updates link to instance methods [ci skip]
|
|\ \
| | |
| | | |
Minor space bump.
|
| | | |
|
|/ /
| |
| |
| | |
with :validate option. Caused by #24532.
|
| |
| |
| |
| |
| |
| | |
s removed
objects added
|