| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This offenced code is introduced from forward ported #36196, since looks
like 6-0-stable branch isn't checked by CodeClimate.
|
| | | |
| | | |
| | | |
| | | | |
https://github.com/rails/rails/blob/65bdd6ad085a02b976cd36f135c2a5ffb522e5a0/activesupport/CHANGELOG.md
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Hide malformed parameters from error page
Accidentally merged this to 6-0-stable so forward porting it to master
here instead.
|
|\ \ \ \
| | | | |
| | | | | |
Update directory name in example commands [ci skip]
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | | |
[ci skip]
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Remove ignored_sql from SQLCounter by adding "TRANSACTION" to log name
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This commit adds "TRANSACTION" to savepoint and commit, rollback statements
because none of savepoint statements were removed by #36153 since they are not "SCHEMA" statements.
Although, only savepoint statements can be labeled as "TRANSACTION"
I think all of transaction related method should add this label.
Follow up #36153
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Fixed typo of dot position [skip ci]
|
|/ / / / |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
The initializer receives `nil` for these options when no cofigurations were given:
https://github.com/rails/rails/blob/v6.0.0.rc1/activerecord/lib/active_record/railtie.rb#L91-L97
|
|\ \ \ \
| | | | |
| | | | | |
Should attempt `committed!`/`rolledback!` to all enrolled records in the transaction
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
transaction
Currently, `committed!`/`rolledback!` will only be attempted for the
first enrolled record in the transaction, that will cause some
problematic behaviors.
The first one problem, `clear_transaction_record_state` won't be called
even if the transaction is finalized except the first enrolled record.
This means that de-duplicated records in the transaction won't refer
latest state (e.g. won't happen rolling back record state).
The second one problem, the enrolled order is not always the same as the
order in which the actions actually happened, the first enrolled record
may succeed no actions (e.g. `destroy` has already succeeded on another
record during `before_destroy`), it will lose to fire any transactional
callbacks.
To avoid both problems, we should attempt `committed!`/`rolledback!` to
all enrolled records in the transaction.
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Remove unnecessary find_partial method
|
|/ / / / |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
The `GC.start` was added at b29e893, but the finalizer has been removed
at 7d0ce78 in #35036.
|
|\ \ \ \
| | | | |
| | | | | |
Clear Resolvers' cache after RenderTestCases tests
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The templates rendered in RenderTestCases tests will be cached by the
resolvers unexpectedly. And this will break other tests when executed in
certain order. (See https://github.com/rails/rails/issues/36154 for more
detail)
So to fix this issue, we just need to clear the caches on all resolvers.
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The virtual attributes(`attachment` and `rich_text`) can't set value
with `fill_in`. So avoid using it. Once #35885 is merged, will be
modified to use it.
Also, add checking attachment attached or not for avoiding
`DelegationError` when attachment didn't attach.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This fixes the following warnings.
```
/rails/activemodel/test/cases/nested_error_test.rb:9: warning: method redefined; discarding old test_initialize
/rails/activemodel/test/cases/error_test.rb:29: warning: previous definition of test_initialize was here
```
|
|\ \ \
| | | |
| | | | |
Recover perf for `pluck` by reverting 9c9c950d02af83742a5f76302d0faa9…
|
|/ / /
| | |
| | |
| | | |
This reverts commit 9c9c950d02af83742a5f76302d0faa99508f242c.
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
yahonda/remove_redundant_test_too_many_binds_testcase
Remove redundant `test_too_many_binds`
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
with `ActiveRecord::BindParameterTest#test_too_many_binds`
sqlite adapter has its own `bind_params_length`, `ActiveRecord::BindParameterTest#test_too_many_binds` respects it.
* Modified `ActiveRecord::BindParameterTest#test_too_many_binds` to show `bind_params_length` value
```
$ git diff
diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb
index 85685d1d00..83cd07f1d7 100644
--- a/activerecord/test/cases/bind_parameter_test.rb
+++ b/activerecord/test/cases/bind_parameter_test.rb
@@ -108,6 +108,7 @@ def test_statement_cache_with_sql_string_literal
def test_too_many_binds
bind_params_length = @connection.send(:bind_params_length)
+ p bind_params_length
topics = Topic.where(id: (1 .. bind_params_length).to_a << 2**63)
assert_equal Topic.count, topics.count
$
```
* Executed modified `ActiveRecord::BindParameterTest#test_too_many_binds`
```
$ bin/test test/cases/bind_parameter_test.rb -n test_too_many_binds
Using sqlite3
Run options: -n test_too_many_binds --seed 47321
999
.
Finished in 0.075249s, 13.2892 runs/s, 26.5784 assertions/s.
1 runs, 2 assertions, 0 failures, 0 errors, 0 skips
$
```
|
|\ \ \ \
| |/ / /
|/| | | |
[ci skip] Correct the stylesheet name used in the guide.
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In the Action Text guides, `app/assets/stylesheets/actiontext.css`
is specified as the file used to style the Action Text editor and
content but the actual file generated from `rails action_text:install`
is `app/assets/stylesheets/actiontext.scss`.
This change simply corrects the file extension shown in the guide.
|
|\ \ \
| | | |
| | | | |
Add Action Cable Release Notes
|
|/ / /
| | |
| | |
| | | |
Co-Authored-By: प्रथमेश Sonpatki <csonpatki@gmail.com>
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
Shopify/fix-association-extension-module-namespace
Namespace association extension modules under the owner model
|
|/ / / |
|
|\ \ \
| |_|/
|/| | |
Active Support release notes [ci skip]
|
| | |
| | |
| | | |
Co-Authored-By: prathamesh-sonpatki <csonpatki@gmail.com>
|
|/ / |
|
|\ \
| | |
| | | |
Update asset compression text [ci skip]
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| | |
* Make scope arity check consistent
* Add test for arity change
[Rob Trame + Rafael Mendonça França]
|
|\ \
| | |
| | | |
Add Release Notes for Active Storage
|
| | |
| | |
| | |
| | | |
Co-authored-by: Abhay Nikam <nikam.abhay1@gmail.com>
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
abhaynikam/35265-remove-unused-argument-layout-from-rendered-template
Removed unused layout attribute from RenderedTemplate
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Active Model release notes [ci skip]
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
azimux/improve-hwia-initialize-by-skipping-to_h-if-already-a-hash
HashWithIndifferentAccess#initialize performance improvement
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Rails 4 -> Rails 5 introduced a #to_hash call in
HashWithIndifferentAccess#initialize to guarantee access to
the #default and #default_proc methods. This can be a very
expensive operation for very large HashWithIndifferentAccess
objects. This commit bypasses this #to_hash call if it is
already a Hash.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Updates to getting started per Rails 6.0 changes [ci skip]
|
| | |/ / / /
| |/| | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Remove database specific sql statements from SQLCounter
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Every database executes different type of sql statement to get metadata then `ActiveRecord::TestCase` ignores these database specific sql statements to make `assert_queries` or `assert_no_queries` work consistently.
Connection adapter already labels these statement by setting "SCHEMA" argument, this pull request makes use of "SCHEMA" argument to ignore metadata queries.
Here are the details of these changes:
* PostgresqlConnectionTest
Each of PostgresqlConnectionTest modified just executes corresponding methods
https://github.com/rails/rails/blob/fef174f5c524edacbcad846d68400e7fe114a15a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb#L182-L195
```ruby
# Returns the current database encoding format.
def encoding
query_value("SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = current_database()", "SCHEMA")
end
# Returns the current database collation.
def collation
query_value("SELECT datcollate FROM pg_database WHERE datname = current_database()", "SCHEMA")
end
# Returns the current database ctype.
def ctype
query_value("SELECT datctype FROM pg_database WHERE datname = current_database()", "SCHEMA")
end
```
* BulkAlterTableMigrationsTest
mysql2 adapter executes `SHOW KEYS FROM ...` to see if there is an index already created as below. I think the main concerns of these tests are how each database adapter creates or drops indexes then ignoring `SHOW KEYS FROM` statement makes sense.
https://github.com/rails/rails/blob/fef174f5c524edacbcad846d68400e7fe114a15a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb#L11
```ruby
execute_and_free("SHOW KEYS FROM #{quote_table_name(table_name)}", "SCHEMA") do |result|
```
* Temporary change not included in this commit to show which statements executed
```diff
$ git diff
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index 8e8ed494d9..df05f9bd16 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -854,7 +854,7 @@ def test_adding_indexes
classname = ActiveRecord::Base.connection.class.name[/[^:]*$/]
expected_query_count = {
- "Mysql2Adapter" => 3, # Adding an index fires a query every time to check if an index already exists or not
+ "Mysql2Adapter" => 1, # Adding an index fires a query every time to check if an index already exists or not
"PostgreSQLAdapter" => 2,
}.fetch(classname) {
raise "need an expected query count for #{classname}"
@@ -886,7 +886,7 @@ def test_removing_index
classname = ActiveRecord::Base.connection.class.name[/[^:]*$/]
expected_query_count = {
- "Mysql2Adapter" => 3, # Adding an index fires a query every time to check if an index already exists or not
+ "Mysql2Adapter" => 1, # Adding an index fires a query every time to check if an index already exists or not
"PostgreSQLAdapter" => 2,
}.fetch(classname) {
raise "need an expected query count for #{classname}"
$
```
* Executed these modified tests
```ruby
$ ARCONN=mysql2 bin/test test/cases/migration_test.rb -n /index/
Using mysql2
Run options: -n /index/ --seed 8462
F
Failure:
BulkAlterTableMigrationsTest#test_adding_indexes [/home/yahonda/git/rails/activerecord/test/cases/migration_test.rb:863]:
3 instead of 1 queries were executed.
Queries:
SHOW KEYS FROM `delete_me`
SHOW KEYS FROM `delete_me`
ALTER TABLE `delete_me` ADD UNIQUE INDEX `awesome_username_index` (`username`), ADD INDEX `index_delete_me_on_name_and_age` (`name`, `age`).
Expected: 1
Actual: 3
bin/test test/cases/migration_test.rb:848
F
Failure:
BulkAlterTableMigrationsTest#test_removing_index [/home/yahonda/git/rails/activerecord/test/cases/migration_test.rb:895]:
3 instead of 1 queries were executed.
Queries:
SHOW KEYS FROM `delete_me`
SHOW KEYS FROM `delete_me`
ALTER TABLE `delete_me` DROP INDEX `index_delete_me_on_name`, ADD UNIQUE INDEX `new_name_index` (`name`).
Expected: 1
Actual: 3
bin/test test/cases/migration_test.rb:879
..
Finished in 0.379245s, 10.5473 runs/s, 7.9105 assertions/s.
4 runs, 3 assertions, 2 failures, 0 errors, 0 skips
$
```
* ActiveRecord::ConnectionAdapters::Savepoints
Left `self.ignored_sql` to ignore savepoint related statements because these SQL statements are not related "SCHEMA"
```
self.ignored_sql = [/^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/]
```
https://github.com/rails/rails/blob/fef174f5c524edacbcad846d68400e7fe114a15a/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb#L10-L20
```ruby
def create_savepoint(name = current_savepoint_name)
execute("SAVEPOINT #{name}")
end
def exec_rollback_to_savepoint(name = current_savepoint_name)
execute("ROLLBACK TO SAVEPOINT #{name}")
end
def release_savepoint(name = current_savepoint_name)
execute("RELEASE SAVEPOINT #{name}")
end
```
|