aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* SQLite: Fix `copy_table` with composite primary keysRyuta Kamizono2017-12-082-6/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | `connection.primary_key` also return composite primary keys, so `from_primary_key_column` may not be found even if `from_primary_key` is presented. ``` % ARCONN=sqlite3 be ruby -w -Itest test/cases/adapters/sqlite3/sqlite3_adapter_test.rb -n test_copy_table_with_composite_primary_keys Using sqlite3 Run options: -n test_copy_table_with_composite_primary_keys --seed 19041 # Running: E Error: ActiveRecord::ConnectionAdapters::SQLite3AdapterTest#test_copy_table_with_composite_primary_keys: NoMethodError: undefined method `type' for nil:NilClass /path/to/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:411:in `block in copy_table' ``` This change fixes `copy_table` to do not lose composite primary keys.
* Merge pull request #30780 from ↵Sean Griffin2017-12-072-0/+23
|\ | | | | | | | | JackMc/fix-chrome-referrer-invalidauthenticitytoken Fix issue #30658 by checking explicitly for 'null' referrer
| * Add a better error message when a "null" Origin header occursJack McCracken2017-11-032-0/+23
| |
* | Fix customizing Content-Type via GCS service URLsGeorge Claghorn2017-12-072-1/+21
| |
* | Merge pull request #31365 from ↵Eileen M. Uchitelle2017-12-077-4/+42
|\ \ | | | | | | | | | | | | bogdanvlviv/add-headless_firefox-driver-to-system_tests Add headless firefox driver to System Tests
| * | Add headless firefox driver to System Testsbogdanvlviv2017-12-077-4/+42
| | |
* | | Fix `scope_for_create` to do not lose polymorphic associationsRyuta Kamizono2017-12-083-3/+26
|/ / | | | | | | | | | | | | | | | | | | | | | | This regression was caused at 213796fb due to polymorphic predicates are combined by `Arel::Nodes::And`. But I'd like to keep that combined because it would help inverting polymorphic predicates correctly (e9ba12f7), and we can collect equality nodes regardless of combined by `Arel::Nodes::And` (`a AND (b AND c) AND d` == `a AND b AND c AND d`). This change fixes the regression to collect equality nodes in `Arel::Nodes::And` as well. Fixes #31338.
* | Merge pull request #31327 from aellispierce/custom-id-change-table-sqliteEileen M. Uchitelle2017-12-072-1/+23
|\ \ | | | | | | Fix sqlite migrations with custom primary keys
| * | Fix sqlite migrations with custom primary keysAshley Ellis Pierce2017-12-062-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if a record was created with a custom primary key, that table could not be migrated using sqlite. While attempting to copy the table, the type of the primary key was ignored. Once that was corrected, copying the indexes would fail because custom primary keys are autoindexed by sqlite by default. To correct that, this skips copying the index if the index name begins with "sqlite_". This is a reserved word that indicates that the index is an internal schema object. SQLite prohibits applications from creating objects whose names begin with "sqlite_", so this string should be safe to use as a check. ref https://www.sqlite.org/fileformat2.html#intschema
* | | Merge pull request #31358 from ↵Andrew White2017-12-071-5/+5
|\ \ \ | | | | | | | | | | | | | | | | yhirano55/made_example_codes_inherit_application_record [ci skip] Make `Todo` classes inherit `ApplicationRecord`
| * | | [ci skip] Make Todo classes inherit ApplicationRecordYoshiyuki Hirano2017-12-071-5/+5
| | | | | | | | | | | | | | | | | | | | Example codes that use `has_many` or `before_create` in `Module::Concerning` look like active record models. So I've made them inherit `ApplicationRecord`.
* | | | Merge pull request #31350 from ptolts/correct_test_spellingYuji Yaginuma2017-12-071-1/+1
|\ \ \ \ | | | | | | | | | | Correct routing test spelling mistake.
| * | | | Correct routing test spelling mistake.Philip Tolton2017-12-061-1/+1
|/ / / /
* | | | Merge pull request #31344 from kamipo/use_string_instead_of_textRyuta Kamizono2017-12-072-32/+43
|\ \ \ \ | | | | | | | | | | Use `:string` instead of `:text` for `JsonAttributeTest`
| * | | | Address `ActiveRecord::NotNullViolation: OCIError: ORA-01400` for Oracle ↵Yasuo Honda2017-12-071-6/+14
| | | | | | | | | | | | | | | | | | | | database which requires primary key value mentioned in insert statement explicitly.
| * | | | Use `:string` instead of `:text` for `JsonAttributeTest`Ryuta Kamizono2017-12-062-5/+10
| | | | | | | | | | | | | | | | | | | | Since CLOB data type has many limitations in Oracle SELECT WHERE clause.
| * | | | Revert "Merge pull request #31341 from yahonda/skip_json_attribute_test"Ryuta Kamizono2017-12-061-24/+22
| | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 23226d04f921b79f0077ba38c5a5a923b6d43f89, reversing changes made to 7544cf7603959f25100b21f70b5e70354bed7e45.
* | | | | Merge pull request #27790 from domcleal/ac-params-each-yieldsRafael França2017-12-062-1/+17
|\ \ \ \ \ | | | | | | | | | | | | Yield array from AC::Parameters#each for block with one arg
| * | | | | Yield array from AC::Parameters#each for block with one argDominic Cleal2017-12-062-1/+17
|/ / / / / | | | | | | | | | | | | | | | Matches Hash#each behaviour as used in Rails 4.
* | | | | Merge pull request #31345 from yhirano55/add_assert_in_epsilon_to_testing_guideEileen M. Uchitelle2017-12-061-0/+2
|\ \ \ \ \ | |/ / / / |/| | | | Add `assert_in_epsilon` to Testing guide [ci skip]
| * | | | Add `assert_in_epsilon` to Testing guide [ci skip]Yoshiyuki Hirano2017-12-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I found `assert_in_epsilon` is not be in "2.4 Available Assertions". So I Added them. MiniTest::Assertions#assert_in_epsilon: https://github.com/seattlerb/minitest/blob/master/lib/minitest/assertions.rb#L204-L210
* | | | | Merge pull request #31341 from yahonda/skip_json_attribute_testSean Griffin2017-12-051-22/+24
|\ \ \ \ \ | | | | | | | | | | | | Execute `JsonAttributeTest` only if `supports_json?` returns `true`
| * | | | | Execute `JsonAttributeTest` only if `supports_json?` returns `true`Yasuo Honda2017-12-051-22/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Oracle enhanced adapter does not fully support JSON datatype then `supports_json?` returns `false`. I wanted to skip known failures and errors when tested with Oracle enhanced adapter.
* | | | | | Merge pull request #31339 from lostapathy/speedup_travisGeorge Claghorn2017-12-051-4/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | Speed up travis by only installing packages when needed
| * | | | | | only install ffmpeg and mupdf on activestorage buildsJoe Francis2017-12-051-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These are needed when GEM=ast, thanks @georgeclaghorn
* | | | | | | Merge pull request #31335 from ttanimichi/more-tests-for-webpack-optionGuillermo Iguaran2017-12-051-3/+24
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | Add more tests for the `--webpack` option
| * | | | | | Add more tests for the `--webpack` optionTsukuru Tanimichi2017-12-051-0/+19
| | | | | | |
| * | | | | | Modify `test_webpack_option`Tsukuru Tanimichi2017-12-051-3/+5
| | | | | | |
* | | | | | | Add missing requireyuuji.yaginuma2017-12-051-0/+2
| |_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up of 3c442b6df91e291ebbf17f37444414bf5f10fbe6 Without this require, it will fail when run CSP test alone. Ref: https://travis-ci.org/rails/rails/jobs/311715758#L2976
* | | | | | Merge pull request #31334 from yhirano55/fix_example_code_in_active_jobRyuta Kamizono2017-12-051-4/+10
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix example code in ActiveJob::Core [ci skip]
| * | | | | | Fix example code in ActiveJob::Core [ci skip]Yoshiyuki Hirano2017-12-051-4/+10
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) It seems that it raise error on example code in `ActiveJob::Core`. Before: ```ruby class DeliverWebhookJob < ActiveJob::Base def serialize super.merge('attempt_number' => (@attempt_number || 0) + 1) end def deserialize(job_data) super @attempt_number = job_data['attempt_number'] end rescue_from(Timeout::Error) do |exception| raise exception if @attempt_number > 5 retry_job(wait: 10) end def perform raise Timeout::Error end end ``` Then it run `DeliverWebhookJob.perform_now` in `rails console`. And raise error: NoMethodError: undefined method `>' for nil:NilClass from /app/jobs/deliver_webhook_job.rb:12:in `block in <class:DeliverWebhookJob>' So I thought it's necessary to fix it. After: ```ruby class DeliverWebhookJob < ActiveJob::Base attr_writer :attempt_number def attempt_number @attempt_number ||= 0 end def serialize super.merge('attempt_number' => attempt_number + 1) end def deserialize(job_data) super self.attempt_number = job_data['attempt_number'] end rescue_from(Timeout::Error) do |exception| raise exception if attempt_number > 5 retry_job(wait: 10) end def perform raise Timeout::Error end end ``` Then it run `DeliverWebhookJob.perform_now` in `rails console`. And it does'nt raise error NoMethodError. 2) Use `Timeout::Error` instead of `TimeoutError` (`TimeoutError` is deprecated).
* / / / / / Fix CSP copy boolean directives (#31326)Simon Dawson2017-12-052-5/+10
|/ / / / / | | | | | | | | | | Use Object#deep_dup to safely duplicate policy values
* | | | | Merge pull request #31279 from ttanimichi/tests-for-webpack-optionGuillermo Iguaran2017-12-041-0/+14
|\ \ \ \ \ | |/ / / / |/| | | | Add tests for the `--webpack` option
| * | | | Add tests for the `--webpack` optionTsukuru Tanimichi2017-12-041-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | We probably don't have any tests for the `--webpack` option. related: #27288
* | | | | `current_version` should catch `NoDatabaseError` from `get_all_versions`Ryuta Kamizono2017-12-041-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | `get_all_versions` doesn't use passed `connection`. So it should be caught `NoDatabaseError` from `SchemaMigration.table_exists?`.
* | | | | Merge pull request #31322 from bogdanvlviv/update-active_record_querying-guideSean Griffin2017-12-031-9/+9
|\ \ \ \ \ | | | | | | | | | | | | Update "Active Record Query Interface" guide [ci skip]
| * | | | | Update "Active Record Query Interface" guide [ci skip]bogdanvlviv2017-12-041-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add missing `LIMIT 1` for some queries - Make some examples of query more readable
* | | | | | Embrace the instantiation in loving parens <3Kasper Timm Hansen2017-12-031-1/+2
| | | | | |
* | | | | | Merge pull request #31146 from ↵Kasper Timm Hansen2017-12-031-41/+83
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | mikeycgto/actiondispatch-cookie-store-test-updates Update cookie_store_test to use encrypted cookies
| * | | | | | Update cookie_store_test to use encrypted cookiesMichael Coyne2017-11-271-41/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This now modernizes these tests to use encrypted cookies instead of using secret_token HMACs. This commit also adds a tests to ensure session cookies with :expires_after set are invalidated and no longer accepted when the time has elapsed.
* | | | | | | Merge pull request #31311 from ↵Kasper Timm Hansen2017-12-034-3/+43
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | y-yagi/ignore_no_database_error_when_loading_schema_cache Ignore `NoDatabaseError` when loading schema cache
| * | | | | | | Make `Migrator.current_version` work without a current databaseyuuji.yaginuma2017-12-034-3/+43
| | |/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is necessary in order to make the processing dependent on `Migrator.current_version` work even without database. Context: https://github.com/rails/rails/pull/31135#issuecomment-348404326
* | | | | | | Fix instrumention name: delete_prefixed like the others.Kasper Timm Hansen2017-12-031-1/+1
| | | | | | |
* | | | | | | SQLite3 valid integer value should be 8 bytes (64-bit signed integer) (#28379)Ryuta Kamizono2017-12-032-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a regression since Rails 4.2. SQLite3 integer is stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value. Assuming default valid value as 4 bytes caused that actual valid value in INTEGER storage class cannot be stored and existing value cannot be found. https://www.sqlite.org/datatype3.html We should allow valid value in INTEGER storage class in SQLite3 to fix the regression. Fixes #22594.
* | | | | | | Emulate JSON types for SQLite3 adapter (#29664)Ryuta Kamizono2017-12-036-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actually SQLite3 doesn't have JSON storage class (so it is stored as a TEXT like Date and Time). But emulating JSON types is convinient for making database agnostic migrations.
* | | | | | | `change_column_default` should be executed after type changingRyuta Kamizono2017-12-033-16/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If do not execute a type changing first, filling in default value may be failed. ``` % ARCONN=postgresql be ruby -w -Itest test/cases/migration/compatibility_test.rb -n test_legacy_change_column_with_null_executes_update Using postgresql Run options: -n test_legacy_change_column_with_null_executes_update --seed 20459 E Error: ActiveRecord::Migration::CompatibilityTest#test_legacy_change_column_with_null_executes_update: StandardError: An error has occurred, this and all later migrations canceled: PG::StringDataRightTruncation: ERROR: value too long for type character varying(5) : UPDATE "testings" SET "foo"='foobar' WHERE "foo" IS NULL ```
* | | | | | | Purge variants with their blobsGeorge Claghorn2017-12-0210-31/+107
| | | | | | |
* | | | | | | Merge pull request #31314 from claudiob/fix-typoYuji Yaginuma2017-12-031-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix typo in test error message
| * | | | | | | Fix typo in test error messageclaudiob2017-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the current code, a failing test shows this error, which is missing the number of times called and has two periods at the end. ``` /railties$ be ruby -Itest test/generators/app_generator_test.rb -n test_active_storage_install Failure: AppGeneratorTest#test_active_storage_install [test/generators/app_generator_test.rb:313]: active_storage:install expected to be called once, but was called times.. Expected: 1 Actual: 2 ``` After the fix, the error message looks correct: ``` /railties$ be ruby -Itest test/generators/app_generator_test.rb -n test_active_storage_install Failure: AppGeneratorTest#test_active_storage_install [test/generators/app_generator_test.rb:313]: active_storage:install expected to be called once, but was called 2 times. Expected: 1 Actual: 2 ```
* | | | | | | | Fix `s/klass.connection/connection/`Ryuta Kamizono2017-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `klass` has removed in 5358f2b67bd6fb12d708527a4a70dcab65513c5e.