| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
* 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
|
|\ \
| | |
| | | |
clarify the touch true option does not trigger after_save/update [ci skip]
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I've gotten tripped up more than a few times on this, thinking that
using `belongs_to` with `touch: true` would trigger my after_save or
after_update callbacks. The same text is in the documentation for the
touch method itself, but I think its helpful to repeat it again here.
It might save people some time.
|
| | | |
|
| | |
| | |
| | |
| | | |
[ci-skip]
|
| | |
| | |
| | |
| | |
| | | |
Even though this means more things to change when we bump after a
release, it's more important that our examples are directly copyable.
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| | |
If we use a real version, at best that'll be an onerous update required
for each release; at worst, it will encourage users to write new
migrations against an older version than they're using.
The other option would be to leave these bare, without any version
specifier. But as that's just a variant spelling of "4.2", it would seem
to raise the same concerns as above.
|
| | |
|