| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In chat Sam Saffron asked how to use the setter now that configurations
is no longer a hash and you need to do AR::Base.configurations["test"]=.
Technically you can do `ActiveRecord::Base.configurations = { the hash
}` but I realized the old way throws an error and is unintuitive.
To aid in the transition from hashes to objects this PR makes a few
changes:
1) Re-adds a deprecated hash setter `[]=` that will add a new hash
to the configurations list OR replace an existing hash if that
environment is already present. This won't be supported in future Rails
versions but a good error is important.
2) Changed to throw deprecation warnings on the methods we decided to support
for hash conversion and raise on the methods we don't support.
3) Refactored the setter/getter hash deprecation warnings messages and
rewrote them.
Getters message:
```
DEPRECATION WARNING: `ActiveRecord::Base.configurations` no longer
returns a hash. Methods that act on the hash like `values` are
deprecated and will be removed in Rails 6.1. Use the `configs_for`
method to collect and iterate over the database configurations.
```
Setter message:
```
DEPRECATION WARNING: Setting `ActiveRecord::Base.configurations` with
`[]=` is deprecated. Use `ActiveRecord::Base.configurations=` directly
to set the configurations instead.
```
4) Rewrote the legacy configurations test file to test all the public
methods in the DatabaseConfigurations class.
|
|\
| |
| | |
Clarify collection proxy docs
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The docs for `ActiveRecord::Associations::CollectionProxy` describe
`ActiveRecord::Associations::Association`. I've moved them to
association and rewrote collection proxy's docs to be more applicable to
what the class actually does.`
[ci skip]
|
| |
| |
| |
| |
| | |
This reverts commit b46601b56d94a02d944ed9bd9494aeea9cba98c8, reversing
changes made to 4e6737f18ab8f0d0e9fbe6f73a92e5d29f1c68f1.
|
| | |
|
|\ \
| | |
| | | |
Correct JavaScript guide example
|
| | |
| | |
| | | |
Swap `#users` jQuery selector to correct position and prevent the escaping of HTML.
|
|\ \ \
| | | |
| | | | |
Avoid extra package install
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Some tests are running yarn install during the test.
The directory used for isolation test is not subject to yarn workspace,
and it occurs because the required package is not installed.
In order to avoid this, I fixed all necessary packages to be installed
before run test and use symlink to `node_modules`.
This is a bit complicated, as `yarn install` needs to be run in a specific
directory before running the test.
However, running `yarn install` every time run the test is expensive
when testing locally and should be avoided.
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
SQLite3: Implement `add_foreign_key` and `remove_foreign_key`
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This reverts commit 141f50ef9ee6ce26820549e9f5b4629ddee182ce, reversing
changes made to 317efa5c3593b70e9cc9a2fcb67488a302b71731.
Reason: `add_foreign_key` and `remove_foreign_key` are implemented at
#35212.
[ci skip]
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
I implemented Foreign key create in `create_table` for SQLite3 at
#24743. This follows #24743 to implement `add_foreign_key` and
`remove_foreign_key`.
Unfortunately SQLite3 has one limitation that
`PRAGMA foreign_key_list(table-name)` doesn't have constraint name.
So we couldn't implement find/remove foreign key by name for now.
Fixes #35207.
Closes #31343.
|
| | | | |
|
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | |
| | | |
(#35217)
This reverts commit 38f9e41f2c4b64377ffb036c53873dbfb51546cf, reversing
changes made to 5e493c3b839f10d639f5cce1f1b9ff9292702821.
Reason: The ajv@6.9.1 was released that fixes issue.
|
|\ \ \
| | | |
| | | | |
Avoid ajv@6.9.0 for now
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Because ajv@6.9.0 does not work with webpack.
Ref: https://github.com/epoberezkin/ajv/issues/941
|
| | | |
| | | |
| | | |
| | | | |
https://travis-ci.org/rails/rails/jobs/491045821#L1528-L1531
|
|\ \ \ \
| |/ / /
|/| | |
| | | | |
Do not allow to add column without column name
|
| | | | |
|
|\ \ \ \
| |/ / /
|/| | | |
Fix memory leaks in development
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
This commit exposes all system wide view paths so that we can clear
their caches.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
This commit splits the digest cache from the "details identity" cache.
Now both caches can be managed independently.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
It makes to ease to handle all short-hand methods (e.g. validates
arguments etc).
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
`object.transform_values!` returns `object` itself.
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
`Association#target=` invokes `loaded!`, so we no longer need to call
the `loaded!` explicitly.
Since Preloader is private API, we don't guarantee that it behaves like
older version as long as using Preloader directly. But this refactoring
fortunately also fix the Preloader compatibility issue #35195.
Closes #35195.
|
|\ \ \ \
| | | | |
| | | | | |
Fix elapsed time calculations
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
I've found a few places in Rails code base where I think it makes sense
to calculate elapsed time more precisely by using
`Concurrent.monotonic_time`:
- Fix calculation of elapsed time in `ActiveSupport::Cache::MemoryStore#prune`
- Fix calculation of elapsed time in
`ActiveRecord::ConnectionAdapters::ConnectionPool::Queue#wait_poll`
- Fix calculation of elapsed time in
`ActiveRecord::ConnectionAdapters::ConnectionPool#attempt_to_checkout_all_existing_connections`
- Fix calculation of elapsed time in `ActiveRecord::ConnectionAdapters::Mysql2Adapter#explain`
See
https://docs.ruby-lang.org/en/2.5.0/Process.html#method-c-clock_gettime
https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way
Related to 7c4542146f0dde962205e5a90839349631ae60fb
|
|\ \ \ \
| | | | |
| | | | | |
Fix `relation.exists?` with giving both `distinct` and `offset`
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The `distinct` affects (reduces) rows of the result, so it is important
part when both `distinct` and `offset` are given.
Replacing SELECT clause to `1 AS one` and removing `distinct` and
`order` is just optimization for the `exists?`, we should not apply the
optimization for that case.
Fixes #35191.
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Bugfix has_many association #size when ids reader is cached and assoc…
|
| | | | |
| | | | |
| | | | |
| | | | | |
is changed
|
| | | | |
| | | | |
| | | | |
| | | | | |
Relation is not best place to do this.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Address test_belongs_to_does_not_use_order_by failure
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
order by for metadata queries
Also, `test_has_one_does_not_use_order_by` should not check metadata queries.
Fixes #35098
|
|\ \ \ \ \
| |_|_|_|/
|/| | | | |
Finish rename of database_operations to database_resolver_context
|
| | | | | |
|
|/ / / / |
|
|\ \ \ \
| |_|/ /
|/| | | |
Improve naming in DatabaseSelector
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
We're already in the resolver, we call this class "operations" in the
middleware, so we should use the same naming here.
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | | |
This is more consistent with Resolver, which has build called. This
allows using a Proc instead of a class, which could be nice if you need
to vary switching logic based on the request in a more ad-hoc way (ie.
check if it is an API request).
|
|\ \ \
| | | |
| | | | |
Fix `relation.create` to avoid leaking scope to initialization block and callbacks
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
callbacks
`relation.create` populates scope attributes to new record by `scoping`,
it is necessary to assign the scope attributes to the record and to find
STI subclass from the scope attributes.
But the effect of `scoping` is class global, it was caused undesired
behavior that pollute all class level querying methods in initialization
block and callbacks (`after_initialize`, `before_validation`,
`before_save`, etc), which are user provided code.
To avoid the leaking scope issue, restore the original current scope
before initialization block and callbacks are invoked.
Fixes #9894.
Fixes #17577.
Closes #31526.
|