| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
To make it easier to construct boundable predicate.
|
|
|
|
|
|
| |
The target object for counter cache is not always determined by the
primary key value on the model. I'd like to extract `update_couters`
onto the `Relation` for the internal use.
|
| |
|
|
|
|
| |
`5 =~ /\d/` returns nil, but Integer doesn't have a `match?` method.
|
|
|
|
|
| |
In cases where the MatchData object is not used, this provides a speed-up:
https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
|
|
|
|
| |
Clean up some concepts in the code while we're here.
|
|
|
|
| |
source is ignored (#33455)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* PostgreSQL 10 new relkind for partitioned tables
Starting with PostgreSQL 10, we can now have partitioned tables natively
* Add comment
* Remove extra space
* Add test for partition table in postgreSQL10
* Select 'p' for "BASE TABLE" and add a test case
to support PostgreSQL 10 partition tables
* Address RuboCop offense
* Addressed incorrect `postgresql_version`
Fixes #33008.
[Yannick Schutz & Yasuo Honda & Ryuta Kamizono]
|
|
|
|
|
|
|
|
|
|
| |
PR#32381 added Rubocop's comments to some tests files in order to
exclude `Performance/RedundantMerge`.
Turn off `Performance` cops for tests files via `Exclude`
in `.rubocop.yml`.
Context https://github.com/rails/rails/pull/32381#discussion_r205212331
|
|\
| |
| | |
Turn on performance based cops
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Use attr_reader/attr_writer instead of methods
method is 12% slower
Use flat_map over map.flatten(1)
flatten is 66% slower
Use hash[]= instead of hash.merge! with single arguments
merge! is 166% slower
See https://github.com/rails/rails/pull/32337 for more conversation
|
| |
| |
| |
| | |
Follow up of #33358 for SQLite3.
|
|\ \
| | |
| | |
| | |
| | | |
albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails
Prefer rails command over bin/rails
|
| | |
| | |
| | |
| | | |
This commit substitutes references to rails/rake task for rails command
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
As discussed in #33203 rails command already looks for, and runs,
bin/rails if it is present.
We were mixing recommendations within guides and USAGE guidelines,
in some files we recommended using rails, in others bin/rails and
in some cases we even had both options mixed together.
|
| |/
|/|
| |
| |
| | |
http links will be redirected to the https version, but still better to
just directly link to the https version.
|
|\ \
| | |
| | |
| | | |
Add strict argument checking to ActiveRecord callbacks
|
|/ /
| |
| |
| | |
This ends up adding it to all save-related callbacks defined in `ActiveRecord::DefineCallbacks`, including e.g. `after_create`. Which should be fine: they didn't support `:on` in the first place.
|
|\ \
| | |
| | | |
[ci skip] Use consistent hash syntax in AR docs
|
| | |
| | |
| | |
| | |
| | | |
The examples with `.where` uses hash w/ symbol keys so it would be more consistent to also do this with `.new`.
Also from my experience the hash w/ symbol keys is more widely used with `where/new/create` etc. in ActiveRecord.
|
|/ /
| |
| |
| | |
The consecutive verbatim blocks were being merged making the output look weird.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Step 6 in #33162
When using Mocha like this:
`ActiveRecord::Base.expects(:establish_connection).with(some_args)`,
the expectations created look something like this:
```
@expectations=
[#<Expectation:0x561350d968e0 expected exactly once, not yet invoked: ActiveRecord::Base.establish_connection("adapter" => "mysql2", "database" => nil) >,
#<Expectation:0x561350dab8f8 allowed any number of times, not yet invoked: ActiveRecord::Base.establish_connection(any_parameters) >,
#<Expectation:0x561350dc30c0 allowed any number of times, not yet invoked: ActiveRecord::Base.connection(any_parameters) >]
```
Minitest mocking (and the way we use it in `MethodCallAssertions`)
expressly refuses to facilitate such permissiive expectations, insisting
that all calls be specified in the actual expected order.
This patch replaces such calls to `Mocha#expects` with
`ActiveSupport::Testing::MethodCallAssertions` and specifies all
expected calls in the epxected order.
|
| |
| |
| |
| | |
A correct, but not obvious use of `ActiveSupport::Testing::MethodCallAssertions`, which might also have been part of #33337 or #33391.
|
| | |
|
| | |
|
| | |
|
| | |
|
|\ \
| | |
| | | |
Avoid extra scoping in delegating to klass methods in the `scope` block
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Since #29301, delegating to klass methods in the `scope` block would
cause extra scoping by the receiver itself. The extra scoping would
always override intermediate scoping like `unscoped` and caused the
regression #33387. To keep the original scoping behavior, should avoid
the extra scoping in the `scope` block.
Fixes #33387.
|
|\ \ \
| |/ /
|/| | |
Use MethodCallAssertions instead of Mocha#expects
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Many calls to `Mocha#expects` preceded the introduction of
`ActiveSupport::Testing::MethodCallAssertions` in 53f64c0fb,
and many are simple to replace with `MethodCallAssertions`.
This patch makes all these simple replacements.
Step 5 in #33162
|
|/ /
| |
| |
| |
| |
| | |
#33363 has two regressions. First one is that `insert_fixtures_set` is
failed if flags is an array. Second one is that connection flags are not
restored if `set_server_option` is not supported.
|
| |
| |
| |
| |
| |
| |
| | |
This reverts commit eb807384c81a6e086b17a576755e992e6c4c685e.
If the current scope is affected by the `unscoped` block, `all` won't be
the same with `spawn`.
|
|\ \
| | |
| | | |
use set_server_option if possible
|
| | | |
|
|\ \ \
| | | |
| | | | |
Normalize the date component to 2000-01-01 automatically
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Also?
Updated failing test.
|
| | | |
| | | |
| | | |
| | | | |
(cherry picked from commit da34d4766c33a042aeb92778a492fa810ec23001)
|
| | | |
| | | |
| | | |
| | | | |
Missed these in preparing #33337
|
|/ / /
| | |
| | |
| | | |
Should have been removed in #33309.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Remove extra stub of `ActiveRecord::Base::connection` in
`activerecord/test/cases/tasks/mysql_rake_test.rb`.
Remove extra stub of `File::exist?` in
`activerecord/test/cases/tasks/sqlite_rake_test.rb`.
`ActiveRecord::Base::establish_connection` shouldn't return `true`
in test cases.
Related to https://github.com/rails/rails/pull/33337.
|
|/ /
| |
| |
| | |
Step 4 in #33162
|
|\ \
| | |
| | | |
Enable `Layout/EmptyLinesAroundBlockBody` to reduce review cost in the future
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We sometimes ask "✂️ extra blank lines" to a contributor in reviews like
https://github.com/rails/rails/pull/33337#discussion_r201509738.
It is preferable to deal automatically without depending on manpower.
|
|\ \ \
| |/ /
|/| | |
Add missing env & config dependency to `rake db:seed`
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Remove returning of `false` value for stubbed `lock_thread=` methods
since there aren't any needs in it.
Remove unnecessary returning of `true` for stubbed `drop_database` method.
Follow up #33309.
Related to #33162, #33326.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
While preparing this I realised that some stubbed returns values
serve no purpose, so this patch drops those as well.
Step 3 in #33162
|
|/ / |
|
| |
| |
| |
| | |
Step 2 in #33162
|