aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* | | | | Fix `test_add_column_with_timestamp_type` failureRyuta Kamizono2017-12-032-7/+8
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | This test failed due to dirty schema cache. It is needed to call `clear_cache!` when using same named table with different definition. https://travis-ci.org/rails/rails/jobs/310627767#L769-L772
* | | | Extract duplicated index column options normalization as ↵Ryuta Kamizono2017-12-035-46/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `options_for_index_columns` And placed `add_options_for_index_columns` in `schema_statements.rb` consistently to ease to find related code.
* | | | Fix warning: assigned but unused variable - tRyuta Kamizono2017-12-031-1/+1
| | | |
* | | | Refactor `length`, `order`, and `opclass` index options dumpingRyuta Kamizono2017-12-039-33/+67
|/ / /
* | | Merge pull request #31230 from dinahshi/postgresql_extract_sqlMatthew Draper2017-12-036-61/+107
|\ \ \ | | | | | | | | Extract sql fragment generators from PostgreSQL adapter
| * | | Extract sql fragment generators for alter table from PostgreSQL adapterDinah Shi2017-12-026-61/+107
| | | |
* | | | Merge pull request #31312 from ↵Yuji Yaginuma2017-12-021-1/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | willnet/add-a-missing-space-before-closing-curly-braces [ci skip] Add a missing space before closing curly braces
| * | | | [ci skip] Add a missing space before closing curly braceswillnet2017-12-021-1/+1
|/ / / /
* | | | Fix method name in `validate_constraint` doc [ci skip]yuuji.yaginuma2017-12-021-1/+1
| | | |
* | | | Merge pull request #27756 from travisofthenorth/validate-foreign-keysMatthew Draper2017-12-028-1/+152
|\ \ \ \ | | | | | | | | | | Add ability to create/validate invalid foreign keys in Postgres
| * | | | Add support for invalid foreign keys in PostgresTravis Hunter2017-12-018-1/+152
| | | | | | | | | | | | | | | | | | | | Add validate_constraint and update naming
* | | | | Make ASt previewer/analyzer binary paths configurableGeorge Claghorn2017-12-014-4/+32
|/ / / /
* | | | Remove unpaired `}` [ci skip]Ryuta Kamizono2017-12-011-2/+1
| | | |
* | | | Tweaks CHANGELOGs [ci skip]Ryuta Kamizono2017-12-012-3/+3
| | | |
* | | | Merge pull request #19090 from ↵Matthew Draper2017-12-019-20/+115
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | gregnavis/support-postgresql-operator-classes-in-indexes Add support for PostgreSQL operator classes to add_index
| * | | | Add support for PostgreSQL operator classes to add_indexGreg Navis2017-11-309-20/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for specifying non-default operator classes in PostgreSQL indexes. An example CREATE INDEX query that becomes possible is: CREATE INDEX users_name ON users USING gist (name gist_trgm_ops); Previously it was possible to specify the `gist` index but not the custom operator class. The `add_index` call for the above query is: add_index :users, :name, using: :gist, opclasses: {name: :gist_trgm_ops}
* | | | | Merge pull request #31241 from matthewd/no-after-forkMatthew Draper2017-12-011-23/+1
|\ \ \ \ \ | | | | | | | | | | | | Drop the before_fork/on_worker_boot advice
| * | | | | Drop the before_fork/on_worker_boot adviceMatthew Draper2017-11-271-23/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's no longer required for Active Record, and other common libraries (dalli, redis-rb) all seem to be fork-proof too.
* | | | | | Remove unnecessary scopingRyuta Kamizono2017-12-011-1/+1
| | | | | |
* | | | | | Class level `update` and `destroy` checks all the records exist before ↵Ryuta Kamizono2017-12-012-13/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | making changes (#31306) It makes more sense than ignoring invalid IDs.
* | | | | | Add ActiveStorage::Previewer#logger to match ActiveStorage::Analyzer#loggerGeorge Claghorn2017-11-301-0/+4
| | | | | |
* | | | | | Maintain raising `RecordNotFound` for class level `update` and` destroy`Ryuta Kamizono2017-12-012-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 35836019, class level `update` and `destroy` suppressed `RecordNotFound` to ensure returning affected objects. But `RecordNotFound` is a common exception caught by a `rescue_from` handler. So changing the behavior when a typical `params[:id]` is passed has a compatibility problem. The previous behavior should not be changed. Fixes #31301.
* | | | | | Merge pull request #31293 from ydakuka/fix-gemfile-guidesYuji Yaginuma2017-12-0111-28/+28
|\ \ \ \ \ \ | | | | | | | | | | | | | | Cosmetic changes for Gemfile [ci skip]
| * | | | | | Cosmetic changes [ci skip]Yauheni Dakuka2017-11-3011-28/+28
| | | | | | |
* | | | | | | Merge pull request #31296 from dixitp012/configuration_update_linksRyuta Kamizono2017-12-011-3/+3
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | [ci skip] Updated links for unicorn which redirect & added https for n…
| * | | | | | | [ci skip] Updated links for uncorn which redirect & added https for nginx linkDixit Patel2017-11-301-3/+3
| |/ / / / / /
* | | | | | | Merge pull request #31292 from noahd1/patch-1Rafael França2017-11-301-0/+22
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Keep current Code Climate behavior before upgrade
| * | | | | | | Keep current Code Climate behavior before upgradeNoah Davis2017-11-291-0/+22
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you merge these changes now (*before Monday, December 4th*), Code Climate will run the same analysis on Rails as it always has on your pull requests. *If you do not merge these changes*, when Code Climate migrates Rails to our new analysis, Code Climate will continue to run Rubocop, but it will ALSO run Code Climate's new maintainability checks (https://codeclimate.com/blog/10-point-technical-debt-assessment). You may want this ... you may not. Just want to make sure you knew the quick option to disable them if it's a problem!
* | | | | | | Add changelog entry for 9d6e28eileencodes2017-11-301-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since this changes a default setting a changelog entry is important.