| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|\
| |
| | |
[ci skip] Fix `#upsert` method comment
|
|/
|
|
|
| |
Because this method only updates or inserts a single record
like `insert` method.
|
| |
|
|\
| |
| | |
Wrap Mysql count of deleted rows in lock block to avoid conflict in test
|
| | |
|
|\ \
| | |
| | | |
Raise `ArgumentError` for invalid `:limit` and `:precision` like as other options
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
options
When I've added new `:size` option in #35071, I've found that invalid
`:limit` and `:precision` raises `ActiveRecordError` unlike other
invalid options.
I think that is hard to distinguish argument errors and statement
invalid errors since the `StatementInvalid` is a subclass of the
`ActiveRecordError`.
https://github.com/rails/rails/blob/c9e4c848eeeb8999b778fa1ae52185ca5537fffe/activerecord/lib/active_record/errors.rb#L103
```ruby
begin
# execute any migration
rescue ActiveRecord::StatementInvalid
# statement invalid
rescue ActiveRecord::ActiveRecordError, ArgumentError
# `ActiveRecordError` except `StatementInvalid` is maybe an argument error
end
```
I'd say this is the inconsistency worth fixing.
Before:
```ruby
add_column :items, :attr1, :binary, size: 10 # => ArgumentError
add_column :items, :attr2, :decimal, scale: 10 # => ArgumentError
add_column :items, :attr3, :integer, limit: 10 # => ActiveRecordError
add_column :items, :attr4, :datetime, precision: 10 # => ActiveRecordError
```
After:
```ruby
add_column :items, :attr1, :binary, size: 10 # => ArgumentError
add_column :items, :attr2, :decimal, scale: 10 # => ArgumentError
add_column :items, :attr3, :integer, limit: 10 # => ArgumentError
add_column :items, :attr4, :datetime, precision: 10 # => ArgumentError
```
|
|\ \ \
| | | |
| | | | |
Except `table_name` from column objects
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The `table_name` was added at #23677 to detect whether serial column or
not correctly.
We can do that detection before initialize column object, it makes
column object size smaller, and it probably helps column object
de-duplication.
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
lxxxvi/documentation_change_foreign_keys_to_bigint_in_association_basics
change `t.integer` to `t.bigint` where applicable
|
| | |/ /
| |/| | |
|
|\ \ \ \
| | | | |
| | | | | |
Improve log messages for #insert_all` / `#upsert_all` etc. methods
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
etc. methods
In #35077, `#insert_all` / `#upsert_all` / `#insert` / `#upsert` etc. methods are added. But Active Record logs only “Bulk Insert” log messages when they are invoked.
This commit improves the log messages to use collect words for how invoked them.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Update configuration of `app` directory and use oxford comma [skip ci]
|
| | | | | | |
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
When skipping duplicates in bulk insert on MySQL, avoid assigning an AUTONUMBER column when not specified
|
| | |_|/ /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
not specified
If `id` is an `AUTONUMBER` column, then my former strategy here of assigning `no_op_column` to an arbitrary column would fail in this specific scenario:
1. `model.columns.first` is an AUTONUMBER column
2. `model.columns.first` is not assigned in the insert attributes
I added three tests: the first test covers the actual error; the second test documents that this _isn't_ a problem when a value is given for the AUTONUMBER column and the third test ensures that this no-op strategy isn't secretly doing an UPSERT.
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
[ci-skip] Add 6.0 Release Notes for Active Record
|
| | |/ /
| |/| | |
|
| |/ /
|/| |
| | |
| | | |
Follow up of c9e4c848eeeb8999b778fa1ae52185ca5537fffe.
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This refactors `execute_grouped_calculation` and slightly changes
generated GROUP BY queries, since I'd not prefer to repeat same
expression in SELECT and GROUP BY clauses.
Before:
```
SELECT COUNT(*) AS count_all, "topics"."author_name" AS topics_author_name, COALESCE(type, title) AS coalesce_type_title FROM "topics" GROUP BY "topics"."author_name", COALESCE(type, title)
```
After:
```
SELECT COUNT(*) AS count_all, "topics"."author_name" AS topics_author_name, COALESCE(type, title) AS coalesce_type_title FROM "topics" GROUP BY topics_author_name, coalesce_type_title
```
Although we generally don't guarantee to support Arel node constructed
by user itself, this also fixes #24207.
|
| |
| |
| |
| | |
`values[:extending]` includes `NullRelation` if `null_relation?`.
|
| |
| |
| |
| |
| |
| | |
Follow up of #35868.
Closes #19349.
|
|\ \
| | |
| | |
| | |
| | | |
kamipo/association_isnt_to_be_affected_by_scoping_consistently
Association loading isn't to be affected by scoping consistently
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Follow-up of 5c71000, #29834, and #30271.
Currently, preloading and eager loading are not to be affected by
scoping, with the exception of `unscoped`.
But non eager loaded association access is still affected by scoping.
Although this is a breaking change, the association loading will work
consistently whether preloaded / eager loaded or not.
Before:
```ruby
Post.where("1=0").scoping do
Comment.find(1).post # => nil
Comment.preload(:post).find(1).post # => #<Post id: 1, ...>
Comment.eager_load(:post).find(1).post # => #<Post id: 1, ...>
end
```
After:
```ruby
Post.where("1=0").scoping do
Comment.find(1).post # => #<Post id: 1, ...>
Comment.preload(:post).find(1).post # => #<Post id: 1, ...>
Comment.eager_load(:post).find(1).post # => #<Post id: 1, ...>
end
```
Fixes #34638.
Fixes #35398.
|
| | |
| | |
| | |
| | |
| | |
| | | |
See https://github.com/rails/rails/pull/35873#issuecomment-480333333
for reference
[Prathamesh Sonpatki, bogdanvlviv]
|
|\ \ \
| | | |
| | | | |
Fix the deprecation warning about `config.active_job.return_false_on_aborted_enqueue`
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
`config.active_job.return_false_on_aborted_enqueue`
- It will return false in Rails 6.1 not 6.0. Also fixed the default
value which is true for new applications.
|
|\ \ \ \
| | | | |
| | | | | |
Fix typo for touch later test description. laster -> later
|
|/ / / / |
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Add missing `touch_all` delegation to relation
|
| | |/ /
| |/| |
| | | |
| | | | |
Follow up of #31513.
|
|\ \ \ \
| |_|_|/
|/| | | |
[ci skip] Mark ActiveRecord::TouchLater as private doc
|
|/ / / |
|
|\ \ \
| |/ /
|/| | |
Do not exclude paths in the global level of Code Climate
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
We use only RuboCop in Code Climate and exclude paths are specified in
RuboCop's setting.
The global level excludes paths should not be specified to match the
behavior of local and CodeClimate.
|
| | |
|
| |
| |
| |
| |
| |
| | |
startercc
https://github.com/sporkmonger/addressable/pull/270
|
| | |
|
| |
| |
| |
| | |
This is completely same with `test_last`.
|
|\ \
| | |
| | | |
Stash `left_joins` into `joins` to deduplicate redundant LEFT JOIN
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Originally the `JoinDependency` has the deduplication for eager loading
(LEFT JOIN). This re-uses that deduplication for `left_joins`.
And also, This makes left join order into part of joins, i.e.:
Before:
```
association joins -> stash joins (eager loading, etc) -> string joins -> left joins
```
After:
```
association joins -> stash joins (eager loading, left joins, etc) -> string joins
```
Now string joins are able to refer left joins.
Fixes #34325.
Fixes #34332.
Fixes #34536.
|
|\ \ \
| | | |
| | | | |
fix typo in the guides (use Rails instead of rails) [ci skip]
|
|/ / / |
|
|\ \ \
| | | |
| | | | |
Add documentation for 'after_save_commit' [ci skip]
|
|/ / / |
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
sushantmittal/add_deattach_from_in_active_support_subscriber
Adds 'detach_from' to 'ActiveSupport::Subscriber' to detach a subscriber from a namespace.
|