Commit Graph

89795 Commits

Author SHA1 Message Date
Jonathan Hefner c2a33059d8
Merge pull request #50108 from jonathanhefner/follow-up-50104
Change disjunction to conjunction in suggestion
2023-11-19 16:02:57 -06:00
Jonathan Hefner 2c240c0366 Change disjunction to conjunction in suggestion
Follow-up to #50104.

The error conditions are that the adapter is spelled incorrectly __or__
the necessary gem isn't in the `Gemfile`.  Therefore, to fix the error,
the user must ensure that the adapter is spelled correctly __and__ the
gem is in the `Gemfile`.

This commit also adds `require "active_support/core_ext/string/filters"`,
which technically should be included for `String#squish`.
2023-11-19 15:49:34 -06:00
Jonathan Hefner 90b55e57a9
Merge pull request #50101 from akhilgkrishnan/document-docker-files
Document docker related files in app folder structure [ci-skip]
2023-11-19 10:16:52 -06:00
Jean Boussier 0af96d2554
Merge pull request #50093 from kmcphillips/ar-adapter-alias
Delay validation of registered Active Record adapters and allow aliasing of adapters
2023-11-19 16:42:49 +01:00
Kevin McPhillips 77df3d50aa Delay validation of registered Active Record adapters. Allow adapter aliasing. 2023-11-19 10:13:08 -05:00
Jean Boussier 6305bd7448
Merge pull request #50104 from joshuay03/improve-adapter-not-found-error-message
Improve `AdapterNotFound` error message
2023-11-19 16:05:28 +01:00
Joshua Young 8174f94e16 Improve `AdapterNotFound` error message 2023-11-19 19:56:26 +09:00
Akhil G Krishnan d08c2c74eb Document docker related files in app folder structure 2023-11-19 10:31:11 +05:30
Jean Boussier 438cad4626
Merge pull request #50090 from fatkodima/fix-active_job-serialization-string-subclasses
Fix ActiveJob arguments serialization to correctly serialize String subclasses having custom serializers
2023-11-18 01:09:27 +01:00
fatkodima 14578eaa4f Fix ActiveJob arguments serialization to correctly serialize String subclasses having custom serializers
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2023-11-18 01:55:24 +02:00
Jean Boussier 6178b8b524
Merge pull request #50089 from fatkodima/fix-console-with-database-url
Fix rails console to work with `DATABASE_URL` for PostgreSQL
2023-11-18 00:25:17 +01:00
fatkodima c00932949f Fix rails console to work with `DATABASE_URL` for PostgreSQL 2023-11-18 00:52:52 +02:00
Jonathan Hefner e514c586f1 Add CHANGELOG entry for #50082 [ci-skip] 2023-11-17 16:43:39 -06:00
Jonathan Hefner c0f40b5a1c
Merge pull request #50082 from chaadow/discard_unrepresentable_blobs_while_preprocessing
[ActiveStorage] Discard unrepresentable blobs while preprocessing
2023-11-17 16:33:45 -06:00
chaadow 2edcda8576 Discard unrepresentable blobs while preprocessing
Preprocessing "unpresentable" blobs (neither variabe, nor previewable)
will result in a `ActiveStorage::UnrepresentableError`, which will retry
following `ActiveJob::Base` default retry logic.

This commit discards any blob that's not representable to cleanup the
job adapter queue.
2023-11-17 22:44:07 +01:00
Jonathan Hefner 92a5a96551
Merge pull request #50088 from conradbeach/improve-find-or-create-by-docs
Fix small typographical errors in `#find_or_create_by` docs [ci-skip]
2023-11-17 15:00:07 -06:00
Conrad Beach 43ff986402
docs: Fix small typographical errors in #find_or_create_by docs
[ci skip]
2023-11-17 13:50:23 -07:00
Jean Boussier e5d3d782b6
Merge pull request #50071 from tgwizard/fix-cache-fetch-multi-read-write-order-of-operations
Adjust instr. for Cache::Store#fetch_multi so writes are after reads
2023-11-17 18:37:39 +01:00
Jean Boussier b7d9654f98
Merge pull request #50075 from kmcphillips/ar-adapter-class-nil-adapter
Do not attempt to resolve an `adapter_class` if no `adapter` is present
2023-11-17 13:35:40 +01:00
Kevin McPhillips 5cd94d9f83 Do not attempt to resolve an adapter_class if no adapter is present 2023-11-17 07:09:27 -05:00
Adam Renberg Tamm 2251a4ba07 Adjust instr. for Cache::Store#fetch_multi so writes are after reads 2023-11-17 11:33:07 +01:00
Jonathan Hefner 550c5d235b
Merge pull request #50081 from maxnotarangelo/fix-typo-in-production-initializer
fix typo in production initializer generator
2023-11-16 17:10:53 -06:00
Max Notarangelo 185c19c5ae fix typo in production initializer generator
And put "info" in quotes.
2023-11-16 15:00:07 -08:00
Jean Boussier 949b4d1482
Merge pull request #49873 from Mangara/mangara-memcache-fallback
Make return value of `Cache::Store#write` consistent
2023-11-16 15:55:51 +01:00
Sander Verdonschot 4cfdcfef8e
Make return values of Cache::Store#write consistent
The return value was not specified before. Now it returns `true` on a
successful write, `nil` if there was an error talking to the cache
backend, and `false` if the write failed for another reason (e.g. the
key already exists and `unless_exist: true` was passed).
2023-11-16 08:54:23 -05:00
Jean Boussier 22a26d7f74
Merge pull request #50064 from Shopify/refactor-adapter-lookup 2023-11-16 13:08:29 +01:00
Jean Boussier 73c090fe1a
Merge pull request #50057 from Shopify/route-source-location-thread-each-caller
Routing::Mapper: Use Thread.each_caller_location if available
2023-11-16 09:35:59 +01:00
Jean Boussier b8d0f398fe Routing::Mapper: Use Thread.each_caller_location if available
Saves a lot of allocations. It's development only though.
2023-11-16 09:08:42 +01:00
Jean Boussier 009c7e7411 Refactor lookup of connection adapters
Right now adapters have to expose a rather byzantine API:

  - They must be defined in `active_record/connection_adapters/<name>_adapter`
  - They must define `ConnectionHandling.<name>_adapter_class`
  - They must define `ConnectionHandling.<name>_connection`

All this is not very DRY and a bit annoying. Additionally it makes
it very hard to define aliases (e.g. `mysql` => `trilogy`), or to
substitute a default adapter for a specialized one.

This refactor aims at making all this easier by exposing a simple
`register` method, that third party adapters can call from a Railtie.
2023-11-16 09:07:44 +01:00
Jonathan Hefner f98bb7ed41
Merge pull request #50046 from chaadow/refactor_preview_tests_and_code
[ActiveStorage] Prevent `AS::Preview#processed` to generate a variant for an empty transformation
2023-11-15 17:16:00 -06:00
Jonathan Hefner c12140a463
Merge pull request #50069 from jonathanhefner/word_wrap-fix-empty-string
Fix `word_wrap` with empty string
2023-11-15 16:36:02 -06:00
Jonathan Hefner 2191f20706 Fix word_wrap with empty string
Follow-up to #45948.

This fixes `word_wrap` to return an empty string instead of `nil` when
given an empty string.

Fixes #50067.
2023-11-15 16:22:02 -06:00
chaadow eae19656fe Prevent `AS::Preview#processed` to generate an empty variant
if an empty hash is passed to a preview call (`blob.preview({})`)
We go through the original preview instead of regenerating a variation
based on the original preview image which would result in a performance
penalty
2023-11-15 21:01:16 +01:00
Eileen M. Uchitelle d424cab951
Merge pull request #50061 from andrewn617/database-configs-for-with-symbol
DatabaseConfigurations#configs_for can accept a symbol in the name param
2023-11-15 14:35:50 -05:00
Jonathan Hefner 67bc7652fb
Merge pull request #50062 from jonathanhefner/readme_rdoc-api-links
Use `api.rubyonrails.org` URLs in `README.rdoc` [ci-skip]
2023-11-14 16:44:37 -06:00
Jonathan Hefner 390db4be35 Use api.rubyonrails.org URLs in README.rdoc [ci-skip]
Follow-up to #49995.

Prior to this commit, `link:classes/...` URLs were used in `README.rdoc`
files so that the URLs would be versioned when rendered at
api.rubyonrails.org.  However, outside of api.rubyonrails.org, such URLs
aren't properly resolved.

Since rails/sdoc#345, `https://api.rubyonrails.org/classes/...` URLs
will also be versioned when rendered at api.rubyonrails.org, and such
URLs are properly resolved everywhere.  Therefore, this commit converts
`link:classes/...` URLs to that form.
2023-11-14 16:35:43 -06:00
Andrew Novoselac c7063f944a DatabaseConfigurations#configs_for can accept a symbol in the name parameter. 2023-11-14 17:25:19 -05:00
Jonathan Hefner 3cac3c3397 Update SDoc to latest revision 2023-11-14 16:08:31 -06:00
Adrianna Chang 0974909b09
Merge pull request #49995 from laicuRoot/fix-links-activerecord-readme
Fix links for the ActiveRecord readme [ci-skip]
2023-11-14 14:46:25 -05:00
Michael Whittaker 4cb497fe15
link to internet archive for valgrind blog link in debugging_rails_applications.md (#50042)
The linked URL to a blog post by Evan Weaver is not available anymore.
This change uses an archived version from the internet archive.
2023-11-14 19:07:44 +01:00
Jean Boussier f2d1366c18
Merge pull request #50058 from Shopify/fix-implicit-strict-locals-again
ActionView::Template fix computation of strict locals
2023-11-14 13:54:44 +01:00
Jean Boussier 427898293d ActionView::Template fix computation of strict locals
Fix: https://github.com/rails/rails/pull/49782

There was a bug in how we computed the list of required keys which
wasn't caught by the test.
2023-11-14 13:14:59 +01:00
Jean Boussier 514a903431 Fix next Rails version in a deprecation message 2023-11-14 13:12:34 +01:00
Jean Boussier 8f9c561716
Merge pull request #50054 from Shopify/deprecator-thread-each-caller
Formally deprecate passing `caller` to `Deprecation#warn`
2023-11-14 10:57:10 +01:00
Jean Boussier 37b0c603d5 Formally deprecate passing `caller` to `Deprecation#warn`
This emitted a warning since 2015, but it's likely most
offenders never saw it.

Ref: 211f55d4fd
2023-11-14 10:33:15 +01:00
Jean Boussier 7fe794cf77
Merge pull request #50053 from Shopify/deprecator-source-templates
ActiveSupport::Deprecation handle blaming generated code
2023-11-14 10:07:21 +01:00
Jean Boussier c2be3ea65c ActiveSupport::Deprecation handle blaming generated code
Fix: #50047

`Backtrace::Location` instance for code generated with eval always
have their `absolute_path` set to `nil`. So if absolute path is nil
we should fallback to checking `#path`.

Co-Authored-By: fatkodima <fatkodima123@gmail.com>
2023-11-14 09:51:41 +01:00
Jonathan Hefner 5b45a58cc8
Merge pull request #50052 from sid-707/fix-grammar-in-generators-guide
Fix grammar in Generators guide to aid readibility [ci skip]
2023-11-13 22:00:40 -06:00
sid-707 781faa1304 Fix grammar to aid readibility 2023-11-13 22:52:25 -05:00
Jonathan Hefner 757f489641
Merge pull request #50044 from jonathanhefner/active_storage-preview-process-variant
Process preview variant when processing preview
2023-11-13 12:38:38 -06:00