| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| | |
[ci skip]
|
| |
| |
| |
| |
| |
| |
| | |
This is related with #27680.
Since `where_values_hash` keys constructed by `where` are string, so we
need `stringify_keys` to `create_with_value` before merging it.
|
|/
|
|
|
| |
Post.where(id: 1).or(Post.where(id: 2)).where(foo: 3).unscope(where: :foo).where_clause.binds.map(&:value)
Would return [2, 3] instead of the expected [1,2]
|
|
|
|
|
|
|
|
|
|
|
| |
The `find_each`, `find_in_batches` and `in_batches` APIs usually operate
on large numbers of records, where it's preferable not to load them all
into memory at once.
If the query cache is enabled, it will hold onto the query results until
the end of the execution context (request/job), which means the memory
used is still proportional to the total number of records. These queries
are typically not repeated, so the query cache isn't desirable here.
|
|\ |
|
| |
| |
| |
| |
| | |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |\
| | |
| | |
| | | |
Enforce frozen string in Rubocop
|
| | | |
|
| |\ \
| | |/
| |/|
| | | |
Make ActiveSupport frozen-string-literal friendly.
|
| | | |
|
|/ / |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Active Record doesn't rely delegating to `arel` in the internal since
425f2ca. The delegation is a lower priority than delegating to `klass`,
so it is pretty unclear which method is delegated to `arel`.
For example, `bind_values` method was removed at b06f64c (a series of
changes https://github.com/rails/rails/compare/79f71d3...b06f64c). But a
relation still could respond to the method because `arel` also have the
same named method (#28976).
Removing the delegation will achieve predictable behavior.
|
|\ \
| | |
| | |
| | |
| | | |
kamipo/remove_method_missing_in_relation_delegation
Remove `method_missing` in `Relation::Delegation`
|
| | |
| | |
| | |
| | | |
The `method_missing` is never reached since 64c53d7c.
|
|\ \ \
| | | |
| | | | |
`Relation#locked?` should not build arel
|
| | |/
| |/|
| | |
| | |
| | | |
The delegation was needed since passing `relation` with
`relation.bound_attributes`. It should use `relation.arel` in that case.
|
|\ \ \
| | | |
| | | | |
Extract `ordered_relation` in `FinderMethods`
|
| |/ / |
|
|/ / |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
If casted value is nil, generated SQL should be `IS NULL`. But currently
it is generated as `= NULL`. To prevent this behavior, avoid making bind
param if casted value is nil.
Fixes #28945.
|
| | |
|
|\ \
| | |
| | |
| | | |
Fix association with extension issues
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This fixes the following issues.
* `association_scope` doesn't include `default_scope`. Should use `scope` instead.
* We can't use `method_missing` for customizing existing method.
* We can't use `relation_delegate_class` for sharing extensions. Should extend per association.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
in `ActiveRecord::Calculations`
`select`, `count`, and `sum` in `Relation` are also `Enumerable` method
that can be passed block. `select` with block already doesn't take
arguments since 4fc3366. This is follow up of that.
|
|\ \ \
| |/ /
|/| | |
Delegate `ast` and `locked` to `arel` explicitly
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Currently `ast` and `locked` are used in the internal but delegating to
`arel` is depend on `method_missing`. If a model class is defined these
methods, `select_all` will be broken.
It should be delegated to `arel` explicitly.
|
| | |
| | |
| | | |
[ci skip]
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
```ruby
require "benchmark/ips"
require "set"
array = [:asc, :desc, :ASC, :DESC, "asc", "desc", "ASC", "DESC"]
set = array.to_set
item = "DESC"
Benchmark.ips do |x|
x.report "array" do
array.include?(item)
end
x.report "set" do
set.include?(item)
end
end
```
```
% ruby array_vs_set.rb
Warming up --------------------------------------
array 188.441k i/100ms
set 229.531k i/100ms
Calculating -------------------------------------
array 3.508M (± 9.0%) i/s - 17.525M in 5.043058s
set 5.134M (± 7.6%) i/s - 25.707M in 5.038921s
```
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
meinac/fix_ambigious_exception_message_of_select_query_method
Fix ambigious error message of select query method [ci skip]
|
| | |/
| |/| |
|
| |/
|/|
| |
| | |
Fixes #29025.
|
|/
|
|
|
|
| |
The argument of `Arel::SelectManager.new` is `table`, not `engine`.
https://github.com/rails/arel/blob/v8.0.0/lib/arel/select_manager.rb#L10
|
|\
| |
| | |
Mixin `CollectionProxy::DelegateExtending` after `ClassSpecificRelation`
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`ClassSpecificRelation` has `method_missing` and the `method_missing` is
called first. if an associated class has the missing method in a
relation, never reach to the `method_missing` in the `CollectionProxy`.
I extracted `DelegateExtending` and included it to the delegate class
that including `ClassSpecificRelation` to fix the issue.
Fixes https://github.com/rails/rails/pull/28246#issuecomment-296033784.
|
|/
|
|
|
|
|
| |
Follow up of 03d3f036.
Some of `respond_to?` were replaced to `respond_to_missing?` in 03d3f036.
But the visibility is still public. It should be private.
|
|\
| |
| | |
Rename `association_query_handler.rb` to `association_query_value.rb`
|
| |
| |
| |
| |
| |
| | |
Since `AssociationQueryHandler` and `PolymorphicArrayHandler` has
removed in #28715, only exists `AssociationQueryValue` and
`PolymorphicArrayValue` in these files.
|
|/
|
|
| |
Partitioning to `values` and `nils` is unneeded before early return.
|
|\
| |
| |
| |
| | |
kamipo/convert_association_queries_to_poro_queries
Convert association queries to PORO queries
|
| |
| |
| |
| | |
association handling
|
| | |
|
| | |
|
| | |
|
|\|
| |
| | |
Expose `queries` for `AssociationQueryValue` and `PolymorphicArrayValue`
|
| | |
|
| |
| |
| |
| | |
It should be handled by `PolymorphicArrayHandler` if polymorphic association.
|
| |
| |
| |
| | |
To ease to customize a relation for `exists?`.
|