Commit Graph

81276 Commits

Author SHA1 Message Date
Daniel Morton 94ccd5410d
`retry_on` parameter `attempts` now accepts `:unlimited` (#41761)
In some applications, some classes of errors may be raised during the
execution of a job which the developer would want to retry forever.

These classes of errors would most likely be infrastructure problems that
the developer knows will be resolved eventually but may take a variable
amount of time or errors where due to application business logic, there
could be something temporarily blocking the job from executing, like a
resource that is needed for the job being locked for a lengthy amount of
time.

While an arbitrarily large number of attempts could previously be passed,
this is inexpressive as sometimes the developer may just need the job to
continue to be retried until it eventually succeeds. Without this,
developers would need to include additional code to handle the situation
where the job eventually fails its attempts limit and has to be re-enqueued
manually.

As with many things this should be used with caution and only for errors
that the developer knows will definitely eventually be resolved, allowing
the job to continue.

[Daniel Morton + Rafael Mendonça França]
2021-07-28 18:32:19 -04:00
Petrik de Heus db947c2917
Add plugin to common command USAGE (#41457)
Because the PluginCommand is defined with `hide_command!`, running
`bin/rails -h` hides the plugin command.

As an alternative to removing the `hide_command!` this adds the plugin
command to the USAGE. Unless it's an engine, because adding an engine to
an engine doesn't make sense.

Both the railtie and engine terms are used so a user can search for both.

[Petrik de Heus + Rafael Mendonça França + Jonathan Hefner]
2021-07-28 17:59:22 -04:00
Rafael França e1170909e2
Merge pull request #41442 from p8/improve-help-for-rake-tasks
Improve help for Rake tasks
2021-07-28 17:43:33 -04:00
Xander d9fda55594
Update resolve_link_as to include SVG (#42892)
* Update resolve_link_as to include SVG

Preloading SVGs won't work without 'as: image' because of:

`Preload of /packs/media/images/81d035675e31079ea9da.svg was ignored due to unknown “as” or “type” values, or non-matching “media” attribute.`

Preloading SVGs can be useful, for instance when using sprites such as bootstrap-icons.

* Adds test case for asset_tag_helper

* Fix test case -- silly mistake

[xanderificnl + Rafael Mendonça França]
2021-07-28 16:26:55 -04:00
David Heinemeier Hansson 0c2a94c265
No underscore style (#42898)
Just like activestorage.js
2021-07-28 15:34:59 -04:00
Rafael França 5970a19f1b
Merge pull request #42897 from intrip/remove-offensive-wording
Remove offensive wording from active record
2021-07-28 15:27:20 -04:00
Jacopo d7c0b4542c Remove offensive wording from active record
Remove "This shit is nasty" offensive wording from active record.
2021-07-28 21:25:50 +02:00
Rafael França 93b3344536
Merge pull request #42896 from ghiculescu/patch-2
Add more detail about what hosts are allowed
2021-07-28 15:21:47 -04:00
David Heinemeier Hansson 6c96e1cd7b
Move Active Storage JS to ESM and drop Babel transpiling (#42895)
* Move to ESM and drop Babel transpiling

* Make the activestorage JS directly available through the asset pipeline as a precompiled asset

* Use example with direct attachment

* Explain that direct reference is possible

* Active Storage JS is a module

* Retain umd asset for backwards compatibility, add ESM file in addition

* Explain how to use activestorage.esm with importmap

* Use untranspiled activestorage inclusion

* Don't repeat terser options
2021-07-28 15:17:13 -04:00
Rafael França 9d2a214e05
Merge pull request #42867 from sato11/rename-middleware-remove
"Middleware#remove" is renamed "Middleware#delete!"
2021-07-28 14:45:23 -04:00
Alex Ghiculescu 76996bce10 Add more detail about what hosts are allowed
Fixes https://github.com/rails/rails/issues/41545
2021-07-28 13:40:14 -05:00
Rafael França 4ae0390c10
Merge pull request #42894 from jonathanhefner/fix-incomplete-nodoc
Fix incomplete :nodoc: directives [ci-skip]
2021-07-28 13:39:46 -04:00
Jonathan Hefner d766c672ec Apply :nodoc: to all DatabaseStatements overrides [ci-skip] 2021-07-28 12:30:51 -05:00
Jonathan Hefner 11c2c0ef2f Fix incomplete :nodoc: directives [ci-skip] 2021-07-28 10:30:06 -05:00
eileencodes 311d0babfb
Remove "stupid" from active record
The language in the docs is clearer without saying MySQL is stupid. The
test doesn't need stupid in the value to be used - an incorrect value is
incorrect.
2021-07-28 11:09:10 -04:00
Jean Boussier f7cedc6b43
Merge pull request #42626 from Shopify/as-file-store-remove-local-cache
Remove LocalCache in FileStore
2021-07-28 17:06:56 +02:00
Jean Boussier 8a22369071
Merge pull request #42870 from pedrosnk/pm/import_of_active_support_test_assertions
assert_changes works on including ActiveSupport::Assertions class
2021-07-28 15:59:21 +02:00
Jean Boussier 5ac9366699
Merge pull request #42702 from hahmed/add-favicon-to-internal-routes
Add favicon to internal routes `/favicon.ico`
2021-07-28 15:31:12 +02:00
Jean Boussier 5f22ae4c94
Merge pull request #42891 from dm-murphy/patch-2
Fix column names on Customer model
2021-07-28 00:07:04 +02:00
Daniel Murphy f73d9c2473
Fix column names on Customer model
@byroot 

This fix replaces lingering instances of a "name" column for the Customer model that was previously changed to "first_name".  Thank you!
2021-07-27 18:05:31 -04:00
Jean Boussier 796aba1678
Merge pull request #40822 from fatkodima/fix-mysql-column-default
Fix retrieving default value for text column for MariaDB
2021-07-27 23:30:26 +02:00
Jean Boussier bbaf40bd7f Update globalid to 0.5.1 for ruby-head compatibility
https://github.com/ruby/uri/pull/26 was recently pulled
in ruby-head, and it breaks globalid < 0.5.
2021-07-27 23:23:13 +02:00
Jean Boussier 75a864c2b6
Merge pull request #42889 from santib/fix-nodoc
Fix :nodoc: [ci skip]
2021-07-27 22:35:56 +02:00
Santiago Bartesaghi 92f12d77c4 Fix :nodoc: [ci skip] 2021-07-27 16:52:58 -03:00
Jorge Manrubia a29884d733 Remove mechanism to disable test parallelization when runnin gonly 1 test
#42761 made the old system of disable paralleling testing when
only one test file was included obsolete.
2021-07-27 10:33:09 -07:00
Jonathan Hefner 71cbc9150f
Merge pull request #42885 from santib/fix-instrumentation-guides
Remove empty section from the instrumentation guides [ci skip]
2021-07-27 11:00:45 -05:00
Santiago Bartesaghi 905d20bc8a Improve sections on instrumentation guides [ci skip] 2021-07-27 12:42:43 -03:00
Jean Boussier 4cc602c02f
Merge pull request #42881 from etiennebarrie/fix-current-attributes-test-leak
Remove leak when using CurrentAttributes in thread variables
2021-07-27 12:25:40 +02:00
Étienne Barrié 39b382cf78 Remove leak when using CurrentAttributes in thread variables
The test for CurrentAttributes using thread-local variables leaks
an instance in Thread.current.

Usually instances are reset in the test helper but the objects remain:
activesupport/lib/active_support/current_attributes/test_helper.rb:11

In this situation we use clear_all to make sure we don't leave instances
behind when the configuration is changed.
2021-07-27 11:50:37 +02:00
Eugene Kenny 85e4ac6f86
Merge pull request #42853 from jonathanhefner/guides-clipboard-text-attribute
Render copy-to-clipboard text in element attribute [ci-skip]
2021-07-27 08:50:54 +01:00
Eugene Kenny cca3911c16
Merge pull request #42860 from dixpac/dix/remove_deprecated_time_zone_initializer
FIX: Setting remove_deprecated_time_with_zone_name in new framework defaults
2021-07-27 08:36:35 +01:00
David Heinemeier Hansson 9c73d4aeab
Make Action Text + Trix JS/CSS available via the asset pipeline (#42857)
* Action Text JS should be available via the asset pipeline too

* Main was a module anyway, no need to reference that twice

* Fix rollup references

* Precompile action text JS for asset pipeline

* No JavaScript dependencies needed with the asset pipeline

* Stub Webpacker::Engine to trigger webpack path for testing

* Extract asset paths

* Exercise asset pipeline path

* Terser doesn't do anything useful on this small package

* Make trix directly available to the asset pipeline

* Indirect doesn't carry its worth

* Reminder for development about keeping things in sync for the asset pipeline

* Ensure this isn't turned into undefined while mirroring

* Mirror Trix CSS for asset pipeline

* Add the needed JS include tag automatically under the asset pipeline

* Please RuboCop

* Keep the peer dependency

Even though we also need it explicitly as a dev dependency in order to generate the mirror output for trix.

* Fix test

* Add CHANGELOG entry
2021-07-26 18:57:42 -04:00
Jonathan Hefner e9ed23786d
Merge pull request #42876 from AkhilGKrishnan/guides-grammer-issue-fix
Active job basic doc grammatical mistakes fixed [ci-skip]

Co-authored-by: Petrik de Heus <petrik@deheus.net>
2021-07-26 12:19:53 -05:00
akhilgkrishnan bf79a4c8e2 Active job basic doc grammer mistakes fixed 2021-07-26 22:41:20 +05:30
Junichi Sato 1f74b849dc
Use definite article in comment to specify returned value
Co-authored-by: Petrik de Heus <petrik@deheus.net>
2021-07-26 17:55:42 +09:00
Junichi Sato 6b48d3ba8d
Use definite article in comment to specify returned value
Co-authored-by: Petrik de Heus <petrik@deheus.net>
2021-07-26 17:55:29 +09:00
Eugene Kenny 25f6a8e84f
Merge pull request #42809 from eugeneius/rm_request_response_requires
Don't require ActionDispatch::{Request,Response}
2021-07-26 02:06:02 +01:00
Eugene Kenny e9b7403bb9
Merge pull request #42808 from eugeneius/log_rescued_responses_env_config
Pass log_rescued_responses as environment config
2021-07-26 02:05:48 +01:00
Junichi Sato 6596875044
Remove redundant whitespace from actionpack/CHANGELOG.md
Co-authored-by: Marivaldo Cavalheiro <marivaldo@gmail.com>
2021-07-26 09:22:36 +09:00
Junichi Sato d7560b18cb Provide `delete` and `delete!` with some rdoc description 2021-07-26 09:19:02 +09:00
Pedro Medeiros f6ffdcfcff assert_changes works on including Assertions class
assert_not_equal is an alias for refute_equal that is defined only on
the class ActiveSupport::TestCase. This commit ensures
ActiveSupport::Testing::Assertions#assert_changes doesn't depends on
ActiveSupport::TestCase to work.
2021-07-25 14:27:18 -04:00
Junichi Sato aff17a82f6 "Middleware#remove" is renamed "Middleware#delete!"
This commit intends to clarify the difference between
`Middleware#delete` and `Middleware#delete!`.

The former method silently fails when the target item is
not found, while the latter raises an error.

The functionality of `delete!` has been introduced in 688ed70
and given a name `remove`. This commit only renames it.

Also, a brief description of `delete!` method is now
provided for guides so that users can acknowledge the difference.
2021-07-25 19:17:30 +09:00
Ryuta Kamizono 1488cb8440
Merge pull request #42863 from georgeclaghorn/rm-outdated-comment
Remove outdated comment in `ActiveRecord::Associations::AssociationScope#add_constraints`
2021-07-25 17:39:09 +09:00
George Claghorn 3fa7dce079 Remove outdated comment in ActiveRecord::Associations::AssociationScope#add_constraints [ci skip]
This comment was correct when it was added in 65843e1. In that commit, ActiveRecord::AssociationScope#scope applies the nearest association's scope, and #add_constraints skips it.

c8d8899 made the comment incorrect. It modified #scope not to apply the nearest association's scope and #add_constraints to apply scopes for the entire association chain.
2021-07-24 17:55:01 -04:00
Haroon Ahmed 49332c9537 Add favicon to header dom element for welcome controller.
Co-authored-by: Sunny Ripert <sunny@sunfox.org>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
2021-07-24 21:26:49 +01:00
Dino Maric a6c0e84f02 FIX: Setting remove_deprecated_time_with_zone_name in new framework defaults
Setting `remove_deprecated_time_with_zone_name` didn't work because
the value is checked in a framework initialiser, which runs before application initialiser.

This PR moves the setting inside the `config.after_initialize` block.
I've also added 2 tests for this behaviour.

Fixes #42820
2021-07-24 16:47:49 +02:00
Ryuta Kamizono 2a6459d8ca
Merge pull request #42855 from kamipo/fix_to_json
Fix `to_json` after `changes_applied` for `ActiveModel::Dirty` object
2021-07-24 08:38:23 +09:00
Ryuta Kamizono 0f001f00eb Fix `to_json` after `changes_applied` for `ActiveModel::Dirty` object
Follow up to #41677.

Mutation tracking variables are not only `@mutations_from_database` but
also `@mutations_before_last_save`.
2021-07-24 08:22:18 +09:00
Ryuta Kamizono 6abe728e1d
Merge pull request #42854 from jonathanhefner/current_page-with-trailing-slash
Fix current_page? when URL has trailing slash
2021-07-24 08:00:02 +09:00
Jonathan Hefner 8ace007519 Fix current_page? when URL has trailing slash
This fixes the `current_page?` helper when the given URL has a trailing
slash, and is an absolute URL or also has query params.

Fixes #33956.

Co-authored-by: Rien Maertens <rien.maertens@posteo.be>
2021-07-23 17:03:45 -05:00