| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Two threads may be in method_missing at the same time. If so, they might
both try to define the same delegator method.
Such a situation probably wouldn't result in a particularly spectacular
bug as one method would probably just be overridden by an identical
method, but it could cause warnings to pop up. (It could be worse if
method definition is non-atomic in a particular implementation.)
(We will also need this mutex shortly anyway, see #8127.)
|
| |
|
|
|
|
| |
We should not need any `serialized_attributes` checks outside `ActiveRecord::AttributeMethods::Serialization` module.
|
|
|
|
|
|
|
|
| |
Most apps upgrading from 3.x will have options for mass assigment in
their application.rb and environments/*.rb config files. Rather than
just raising a NoMethodError when copying the config, this commit
adds a warning message until either the protected_attributes gem
is installed or the relevant config options are removed.
|
|
|
|
|
| |
These were removed with ActiveRecord::Model in
https://github.com/rails/rails/commit/9e4c41c903e8e58721f2c41776a8c60ddba7a0a9#L15L156
|
| |
|
|
|
|
|
|
|
|
| |
Rather than just changing it and hoping for the best.
Requested by @jeremy:
https://github.com/rails/rails/commit/ba1544d71628abff2777c9c514142d7e9a159111#commitcomment-2106059
|
|\
| |
| | |
:counter_cache option for to support custom named counter caches
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
So that the scope may be a NullRelation and return a result without
executing a query.
Fixes #7928
|
| |
| |
| |
| |
| |
| |
| | |
Fixes #8102.
I couldn't find a nicer way to deal with this than delegate the call to
#scope, which will be a NullRelation when we want it to be.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This allows us to avoid hacks like the "return 0 if owner.new_record?"
in #count (which this commit removes).
Also, the relevant foreign key may actually be present even on a new
owner record, in which case we *don't* want a null relation. This logic
is encapsulated in the #null_scope? method.
We also need to make sure that the CollectionProxy is not 'infected'
with the NullRelation module, or else the methods from there will
override the definitions in CollectionProxy, leading to incorrect
results. Hence the nullify: false option to CollectionAssociation#scope.
(This feels a bit nasty but I can't think of a better way.)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
null relations
For example, the following should not run any query on the database:
Post.new.comments.where(body: 'omg').to_a # => []
Fixes #5215.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Organized the gemspec files a bit.
* Made quotes more consistent (single quotes dominated, so I used
that).
* Moved license line down a line, separating it logically, and removed
the extra whitespace before its = operator.
* Minor whitespace fixes.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
This is already handled by #find, it's a duplicate check, since
find_with_ids is not called from anywhere else.
|
| | |
|
| | |
|
|/ |
|
| |
|
|
|
|
| |
Also refactor the test a bit.
|
|
|
|
| |
message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This comment is not valid since that `if` is there to make possible to
do:
remove_index :users, :name
Instead of:
remove_index :users, column: :name
What is a valid use case.
[ci skip]
|
|
|
|
|
|
|
| |
This was there due historical reasons since
7dc45818dc43c163700efc9896a0f3feafa31138 to give the user the
possibility to create unique indexes passing "UNIQUE" as the third
argument
|
|
|
|
| |
Closes #8104
|
|\
| |
| | |
Fixed grammar in migration pending error.
|
| | |
|
|\ \
| |/
|/|
| |
| |
| |
| | |
Conflicts:
actionpack/lib/action_controller/metal/mime_responds.rb
activerecord/lib/active_record/attribute_methods.rb
guides/source/working_with_javascript_in_rails.md
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 3b89052014c2bf3b8fbbcfb93f657a17dd7e7ca3.
Reason: changes made to a test, albeit in commented lines - non-uniform
change.
[ci skip]
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
to keep 'output' messages untouched.
|
| | |
|
| | |
|
| |\
| | |
| | |
| | |
| | | |
Conflicts:
activerecord/lib/active_record/callbacks.rb
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When calling first(n) or last(n) in a collection, Active Record was
improperly trying to set the inverse of instance in case that option
existed. This change was introduced by
fdf4eae506fa9895e831f569bed3c4aa6a999a22.
In such cases we don't need to do that "manually", since the way
collection will be loaded will already handle that, so we just skip
setting the inverse association when any argument is given to
first(n)/last(n).
The test included ensures that these scenarios will have the inverse of
instance set properly.
Fixes #8087, Closes #8094.
Squashed cherry-pick from d37d40b and c368b66.
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/associations/collection_association.rb
|