| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
It is incorrect to treat `options[:primary_key]` as
`association_primary_key` if `has_many` associations because the
`:primary_key` means the column on the owner record, not on the
association record. It will break `ids_reader` and `ids_writer`.
```ruby
people(:david).essay_ids
# => ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'essays.first_name' in 'field list': SELECT `essays`.first_name FROM `essays` WHERE `essays`.`writer_id` = 'David'
```
Fixes #14439.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Allow `serialize` with a custom coder on `json` and `array` columns
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
We already have a test case for `serialize` with a custom coder in
`PostgresqlHstoreTest`.
https://github.com/rails/rails/blob/v5.1.3/activerecord/test/cases/adapters/postgresql/hstore_test.rb#L316-L335
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Check :scope input in Uniqueness validator
|
| | |_|/ / / /
| |/| | | | | |
|
|\ \ \ \ \ \ \
| |_|_|_|_|/ /
|/| | | | | | |
Completes ActiveRecord::Batches.find_each example [ci skip]
|
| | |_|/ / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | | |
The previous paragraph mentions that you can hand off the same processing
queue to multiple workers. This completes the following example below it.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Remove unused `source_type_info` in `RuntimeReflection`
|
| | |_|/ / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | | |
`source_type_info` is only used for `constraints` in
`PolymorphicReflection`.
|
|/ / / / /
| | | | |
| | | | |
| | | | | |
The primary key on the owner record is abstracted as `join_foreign_key`.
|
|/ / / /
| | | |
| | | |
| | | |
| | | | |
Since `Relation` includes `Enumerable`, it is enough to use `super`
simply.
|
|/ / /
| | |
| | |
| | | |
It can use `AbstractReflection#table_name` simply.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This comment was added at 97849de, but `AssociationProxy` and
`test_triple_equality` was removed at 1644663. Currently the `===` is
used for `test_decorated_polymorphic_where` that added at #11945.
So I updated "association proxies" to "decorated models".
And also, currently `Core::ClassMethods` appears in the doc.
http://api.rubyonrails.org/classes/ActiveRecord/Core/ClassMethods.html
But it looks like that the methods in the module is not public API.
So I also added `# :nodoc:` to the module.
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
chopraanmol1/support_for_has_many_and_has_one_for_where_relation
Fixed query building when relation is passed for has one or has many association in where
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
has many association wrong set of primary key and foreign key are selected.
Changed code to use 'join' primary key and foreign key over 'association' primary key and foreign key.
|
|\ \ \ \
| | | | |
| | | | | |
Use copy to preserve file permissions
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Return Not found Ids in ActiveRecord::NotFound
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This builds on top of 15e2da656f41af0124f7577858536f3b65462ad5.
now it also returns exact Ids which were not found which will be debugging simple.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
More robust PostgreSQL database duplication check
|
| | | | | | | |
|
| | | | | | |
| | | | | | |
| | | | | | | |
Fixes #29045.
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
refs: https://github.com/rails/rails/pull/30161
```
$ echo "+@size+" | rdoc --pipe
<p>+@size+</p>
$ echo "<tt>@size</tt>" | rdoc --pipe
<p><code>@size</code></p>
```
[ci skip]
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Otherwise `ConnectionPool#reap` may run before `@connections` has
initialized.
https://travis-ci.org/rails/rails/jobs/263037427#L888-L890
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Add missed `require`
|
| | |_|/ / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | | |
`ActiveRecord::ConnectionAdapters::QueryCache::ConnectionPoolConfiguration`
depends on `Concurrent::Map`.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
yukideluxe/add-missing-bit-reload-associations-docs
add missing collection.reload documentation [ci skip]
|
| | | | | | | |
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This module has behavior that is not present in `ActiveModel::Dirty`,
which is intended to be public API.
|
|\ \ \ \ \ \
| |_|_|/ / /
|/| | | | | |
add reload_association to documentation
|
| |/ / / / |
|
|/ / / / |
|
|\ \ \ \
| |_|_|/
|/| | | |
Do not let use `serialize` on native JSON/array column
|
| |/ / |
|
| |/
|/|
| |
| |
| | |
Statement caches are used as a concurrent map. It will more clarify to
using `Concurrent::Map`.
|
| | |
|
| |
| |
| |
| |
| |
| | |
Actually `StatementCache#execute` is always passed the same klass that
the owner klass of the connection when the statement cache is created.
So passing `klass` to `StatementCache.new` will make more DRY.
|
|\ \
| | |
| | | |
Handling add/remove to/from migration edge cases
|
| | |
| | |
| | |
| | | |
Making sure the table name is parsed correctly when an add/remove column migration have 'from'/'to' in the table name.
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
kamipo/relation_merger_should_not_fill_empty_values
`Relation::Merger` should not fill `values` with empty values
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Currently `Relation#merge` will almost fill `values` with empty values
(e.g. `other.order_values` is always true, it should be
`other.order_values.any?`). This means that `Relation#merge` always
changes `values` even if actually `values` is nothing changed. This
behavior will makes `Relation#empty_scope?` fragile. So `Relation#merge`
should avoid unnecessary changes.
|
|\ \ \ \
| | | | |
| | | | | |
Fix `find_by` with range conditions
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
`StatementCache` doesn't support range conditions. So we need to through
the args to `FinderMethods#find_by` if range value is passed.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Sync transaction state when accessing primary key
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
If a record is modified inside a transaction, it must check the outcome
of that transaction before accessing any state which would no longer be
valid if it was rolled back.
For example, consider a new record that was saved inside a transaction
which was later rolled back: it should be restored to its previous state
so that saving it again inserts a new row into the database instead of
trying to update a row that no longer exists.
The `id` and `id=` methods defined on the PrimaryKey module implement
this correctly, but when a model uses a custom primary key, the reader
and writer methods for that attribute must check the transaction state
too. The `read_attribute` and `write_attribute` methods also need to
check the transaction state when accessing the primary key.
|
|\ \ \ \ \ \
| |_|_|_|/ /
|/| | | | | |
Avoid duplicate clauses when using #or
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Condenses the clauses that are common to both sides of the OR and put them outside, before the OR
This fix the current behavior where the number of conditions is exponential based on the number of times #or is used.
|