- 01 5月, 2019 8 次提交
-
-
由 Yasuo Honda 提交于
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 ```
-
由 Akira Matsuda 提交于
e.g. via test-unit-rails' `run_setup`
-
由 Aaron Patterson 提交于
any? should be delegated to the errors list
-
由 Eileen M. Uchitelle 提交于
Revert changes to monotonic times
-
由 Aaron Patterson 提交于
Otherwise we get deprecation warnings in the generated scaffold template files
-
由 Kevin Solorio 提交于
The change to monotonic times causes failures for applications where the subscribed block is expecting Time objects as described in this issue: https://github.com/rails/rails/issues/36145 The original PR (https://github.com/rails/rails/pull/35984) was concerned with errors on the cpu_time. Test was edited to reflect changes to initializer using 0 values instead of nil
-
由 Ryuta Kamizono 提交于
[Guides] Remove dynamic_form gem reference in guides [ci skip]
-
由 Carles Jove i Buxeda 提交于
This gem has not been updated since April 2014 and 2 of the 4 methods it introduces have been broken since Rails 4
-
- 30 4月, 2019 9 次提交
-
-
由 Ryuta Kamizono 提交于
Should take the record's state of first action in the transaction
-
由 Ryuta Kamizono 提交于
If the same id's records are saved and/or destroyed in the transaction, commit callbackes will only run for the first enrolled record. https://github.com/rails/rails/blob/a023e2180093ebc517a642aaf21f3c7241c67657/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb#L115-L119 The regression #36132 is caused due to #35920 changed the enrollment order that the first action's record will be enrolled to last in the transaction. We could not change the the enrollment order as long as someone depends on the enrollment order. Fixes #36132.
-
由 Alex Kitchens 提交于
Action Mailer release notes [ci skip]
-
由 Ryuta Kamizono 提交于
-
由 Prathamesh Sonpatki 提交于
-
由 प्रथमेश Sonpatki 提交于
[ci skip] Add 6.0 Release Notes for Action View
-
由 Ryuta Kamizono 提交于
Fix incorrect url in guide [ci skip]
-
由 Robin Fisher 提交于
The example functional test lists the 'create' route as article_url rather than articles_url
-
由 Alex Kitchens 提交于
I've added release notes based off of the CHANGELOG for Action View.
-
- 29 4月, 2019 3 次提交
-
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
Improve error message of ActiveSupport delegate
-
由 okuramasafumi 提交于
ActiveSupport `delegate` has `to` option, but it's not a option hash anymore and now it's a keyword argument. When `to` argument is not given, it raises an ArgumentError but the message suggests supplying "options hash", which is now wrong. Now it's fixed to provide correct suggestion to supply a keyword argument.
-
- 28 4月, 2019 2 次提交
-
-
由 Xavier Noria 提交于
-
由 Xavier Noria 提交于
-
- 27 4月, 2019 6 次提交
-
-
由 प्रथमेश Sonpatki 提交于
[ci skip] Update the guide's model generator output.
-
由 Alec Clarke 提交于
The model generator code sample used in the command line guides was displaying an outdated output for the generator's usage. This change updates the sample to mirror what's currently output when running `$rails generate model`.
-
由 Ryuta Kamizono 提交于
Fix merging left_joins to maintain its own `join_type` context
-
由 Ryuta Kamizono 提交于
This fixes a regression for #35864. Usually, stashed joins (mainly eager loading) are performed as LEFT JOINs. But the case of merging joins/left_joins of different class, that (stashed) joins are performed as the same `join_type` as the parent context for now. Since #35864, both (joins/left_joins) stashed joins might be contained in `joins_values`, so each stashed joins should maintain its own `join_type` context. Fixes #36103.
-
由 Guilherme Mansur 提交于
* Fallback to spawn instead of fork in jruby This commit: b342db68 introduced a `fork` fork when running the railties tests since this is not supported in jruby we fallback to using spawn. Fixes: https://github.com/rails/rails/issues/35900
-
由 Jordan Thomas 提交于
* Add test asserting truncate returns unfrozen string * Ensure strings returned from truncate are not frozen This fixes an issue where strings too short to be truncated were returned unfrozen, where as long-enough strings were returned frozen. Now retuned strings will not be frozen whether or not the string returned was shortened. * Update changelog w/ new truncate behavior description [Jordan Thomas + Rafael Mendonça França]
-
- 26 4月, 2019 10 次提交
-
-
由 प्रथमेश Sonpatki 提交于
Add 6.0 Release Notes for Action Pack
-
由 Alex Kitchens 提交于
I've gone through the CHANGELOG for Action Pack, pulled out anything that was backported, rephrased some of the descriptions and found their PR's/commits as links.
-
由 George Claghorn 提交于
See 19770d6c.
-
由 Kasper Timm Hansen 提交于
Bump bootsnap to a version with disables iseq_cache for Ruby 2.5
-
-
由 Rafael França 提交于
Fixes grammar in comments on tag_name and tag_id
-
由 Kasper Timm Hansen 提交于
-
由 Kasper Timm Hansen 提交于
-
由 Kasper Timm Hansen 提交于
-
由 Michael Bock 提交于
-
- 25 4月, 2019 2 次提交
-
-
由 Ryuta Kamizono 提交于
Bump gem version to 6.0.0.rc1.
-
由 Ryuta Kamizono 提交于
Fix outdated yarn.lock
-