Commit Graph

89149 Commits

Author SHA1 Message Date
Jean Boussier
02e679ba75 Get rid of the jruby_skip test helper
The last test calling it actually passes on latest
JRuby.
2023-10-02 13:01:44 +02:00
Shozo Hatta
b10a2e4943
[ci-skip][Docs]Add encryption.add_to_filter_parameters to configuring.md (#49443)
* Add encryption.add_to_filter_parameters to configuring.md

encryption.add_to_filter_paramters has been merged by https://github.com/rails/rails/pull/46453.

(This PR is a second try of https://github.com/rails/rails/pull/49364 )

* Update entry for encryption.add_to_filter_parameters

Co-authored-by: Rafael Mendonça França <rafael@rubyonrails.org>
2023-10-02 06:39:40 -04:00
Jean Boussier
af2b1daf1d
Merge pull request #49452 from Shopify/pg-ensure-type-map-loaded
Ensure PG connection is configured before looking up types
2023-10-02 10:05:46 +02:00
Jean Boussier
618db1377f Ensure PG connection is configured before looking up types
Fix: https://github.com/rails/rails/issues/49439

Because Postgres adapter types are connection dependent,
we can't lookup types without first connecting to the database.

Note, this really isn't good, ideally types should be stored in the
schema cache so that we don't have to extract types every time.
2023-10-02 09:48:09 +02:00
Rafael Mendonça França
7c303b9ddf
Merge pull request #49442 from p8/actionpack/notifications-tests
Add tests for send_file and redirect_to instrumentation
2023-10-01 17:30:00 -04:00
Rafael Mendonça França
5b159f4270
Merge pull request #49437 from tnir/tn-remove-config-on-skip-ac
Avoid Action Cable config in dev templates on --skip-action-cable
2023-10-01 17:28:40 -04:00
Rafael Mendonça França
77cdcb3993
Fix CHANGELOG 2023-10-01 21:27:28 +00:00
Rafael Mendonça França
001f7a4c53
Merge pull request #49438 from kddnewton/prism-render-parser
Use prism for parsing renders when available
2023-10-01 17:25:10 -04:00
Jonathan Hefner
b68cc94096
Merge pull request #49447 from jonathanhefner/message_pack-fix-rails_max_threads
Fix `AS::MessagePack` with `ENV["RAILS_MAX_THREADS"]`
2023-10-01 15:51:43 -05:00
Rafael Mendonça França
0ba14ebab8
Revert "Merge pull request #49056 from joshuay03/raise-on-duplicate-accepts-nested-attributes-for"
This reverts commit b6166e8da2a395f55b275ac9fdc8b957fb97d54a, reversing
changes made to 5415d3a19ad4eb26a4e57bb31c06187ea5172812.
2023-10-01 20:50:23 +00:00
Jonathan Hefner
bb8ad695f4 Fix AS::MessagePack with ENV["RAILS_MAX_THREADS"]
`ENV` values are strings, so `ENV["RAILS_MAX_THREADS"]` must be parsed
as an int.

Unfortunately, `MessagePack::Factory::Pool::MemberPool` does not expose
a method to check its member count, so the most we can assert is that
roundtripping works as expected.

Fixes #49446.
2023-10-01 15:22:05 -05:00
Rafael Mendonça França
0f7fe4ab01
Revert "Also rescue TZInfo::ZoneinfoDirectoryNotFound when loading time zone data"
This reverts commit 54f30488e190eea5e923fe51914051df0e8c33f6.

Reason: THis isn't necessary. `TZInfo::DataSource.get` makes sure
the exception gets translated.
2023-10-01 20:20:06 +00:00
Niklas Häusele
898a248132
rails db:drop now removes -shm and -wal sqlite files (#49436)
fixes #49435
2023-10-01 20:03:21 +00:00
Petrik
989de534a5 Add tests for send_file and redirect_to instrumentation 2023-09-30 17:22:56 +02:00
Kevin Newton
d743a2b10f
Use Prism for parsing renders when available
Instead of ripper
2023-09-29 20:57:54 -04:00
Takuya Noguchi
5f3c0d6bee Avoid Action Cable config in dev templates on --skip-action-cable
rails new --skip-aciton-cable now generates config/environments/development.rb
without Action Cable configurations.

Follows up PRs 22586 and 24169

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2023-09-30 00:33:03 +00:00
Rafael Mendonça França
a5f113f433
Merge pull request #49423 from paulreece/update_has_one_doc
Added available methods for has_one association to guide.
2023-09-29 16:24:07 -04:00
Rafael Mendonça França
180e601196
Merge pull request #49374 from yykamei/add_doc_for_protect_from_forgery
Add notice to documentation for protect_from_forgery's :with option
2023-09-29 16:13:02 -04:00
Rafael Mendonça França
d7b395145c
Merge pull request #49428 from uxxman/main
No need to include error_highlight when ruby version >= 3.2
2023-09-29 16:00:37 -04:00
Rafael Mendonça França
db2ef1d250
Merge pull request #49417 from Edouard-chin/ec-logger-fix
Fix the BroadcastLogger being initialized too late:
2023-09-29 15:45:03 -04:00
Rafael Mendonça França
098eea5be0
Merge pull request #49433 from bdewater/as-notifications-events
Stop building AS::Notifications::Event manually
2023-09-29 14:40:04 -04:00
Rafael Mendonça França
00dd041192
Those features are not merged yet 2023-09-29 18:29:53 +00:00
Bart de Water
95b6fbd00f Stop building AS::Notifications::Event manually
It's possible since Rails 6 (3ea2857943dc294d7809930b4cc5b318b9c39577) to let the framework create Event objects, but the guides and docs weren't updated to lead with this example.

Manually instantiating an Event doesn't record CPU time and allocations, I've seen it more than once that people copy-pasting the example code get confused about these stats returning 0. The tests here show that - just like the apps I've worked on - the old pattern keeps getting copy-pasted.
2023-09-29 12:34:23 -04:00
Ryuta Kamizono
d38dcdc009
Merge pull request #49431 from hachi8833/add_assert_error_reported
[ci-skip][Docs]Add assert_error_reported and assert_no_error_reported to testing.md
2023-09-29 23:02:56 +09:00
Edouard CHIN
40cb50e06e Fix the BroadcastLogger being initialized too late:
- An oversight of #48615 is that it changes the `Rails.logger` to be
  a broadcast logger after the app is booted. Anything referencing
  `Rails.logger` during the boot process will get a simple logger and
  ultimately resulting in logs not being broadcasted.

  For example `ActionController::Base.logger.info("abc")` would
  just output logs in the `development.log` file, not on STDOUT.

  ----

  The only solution I could think of is to create a BroadcastLogger
  earlier at boot, and add logger to that broadcast when needed (instead
  of modiyfing the `Rails.logger` variable).
2023-09-29 15:42:47 +02:00
hachi8833
d41a5dad9a Add assert_error_reported and assert_no_error_reported to testing.md
See #46029.
2023-09-29 19:37:47 +09:00
Petrik de Heus
c788456ea9
Merge pull request #49429 from Earlopain/config-table-formatting [ci skip]
Fix formatting of two configs in configuration guide
2023-09-29 12:35:21 +02:00
Earlopain
f3e0a72801
Fix formatting of two configs in configuration guide 2023-09-29 11:32:41 +02:00
Usman
24b99910cf No need to include error_highlight when ruby version >= 3.2 2023-09-29 09:05:06 +00:00
Jean Boussier
0d0e6bd5df
Merge pull request #49378 from Shopify/ar-delay-version-check
Delay Adapter#check_version to #configure_connection
2023-09-29 09:21:38 +02:00
Jean Boussier
2da1852ac9 Delay Adapter#check_version to #configure_connection
Ideally we should be able to checkout an Adapter instance without
triggering a connection to the server.

For some adapters like Trilogy that is the case today, but only if
you have a schema cache loaded, otherwise `check_version` will trigger
a query.

I think this check can be delayed to when we actually use the connection.
2023-09-29 08:53:16 +02:00
Yutaka Kamei
f7cc8b3191
Move up the notice to the line of :with explanation 2023-09-29 11:45:42 +09:00
Hartley McGuire
0b2fb5d29f
Merge pull request #49427 from koic/tweak_async_api_docs
Tweak the docs for `async_*` APIs [ci skip]
2023-09-28 22:26:24 -04:00
Koichi ITO
0bdf160f3a Tweak the docs for async_* APIs [ci skip]
This PR adds period at the end of sentences to maintain consistency in the `async_*` API document.
2023-09-29 11:19:21 +09:00
Rafael Mendonça França
deb0869f3b
Merge pull request #49426 from skipkayhil/hm-rm-default-forgery-accessor
Rm unused default_protect_from_forgery accessor
2023-09-28 21:32:23 -04:00
paulreece
519558108e This adds the following methods to the definition of available methods in the guide:
belongs_to - foreign_type, :required, :default, :strict_loading, and :ensuring_owner_was .
has_one - :required, :disable_joins, :strict_loading, :query_constraints, and :ensuring_owner_was .
has_many - :disable_joins, :ensuring_owner_was, :extend, :foreign_type, :query_constraints, :strict_loading
has_and_belongs_to_many - :strict_loading .
2023-09-28 21:20:44 -04:00
Hartley McGuire
3946ef20e1
Rm unused default_protect_from_forgery accessor
This was [added][1] when the default configuration was added for Rails
5.2, however the accessor itself has never been documented or used.
`protect_from_forgery: :exception` is added based on  whether the
configuration is set on `config.action_controller` and not this value.

Since the accessor is undocumented and unused, this commit removes it.

[1]: 48cb8b3e7097e9a1cb45b2298f59b9179f0dbdee
2023-09-28 20:38:44 -04:00
Hartley McGuire
b4d8603bd3
Merge pull request #49418 from akhilgkrishnan/html-to-erb
Fix the wrong markdown highlighting [skip ci]
2023-09-28 13:26:44 -04:00
Rafael Mendonça França
af95a7d89f
Merge pull request #49416 from Shopify/fix-render-call-extractor-on-ruby-3.3
Fix RenderCallExtractor to be compatible with Ruby 3.3
2023-09-28 11:57:23 -04:00
Rafael Mendonça França
02313b836e
Merge pull request #49412 from fatkodima/fix-multiple-dbs-example
Enable raising when running `rubocop-md` against invalid ruby snippets
2023-09-28 11:54:39 -04:00
Jean Boussier
ef21ab6a88
Merge pull request #49415 from Shopify/schema-cache-server-version
Move the database version cache from schema cache to pool config
2023-09-28 17:17:16 +02:00
Akhil G Krishnan
2e35046f61 Fix the wrong markdown hightlighting [skip ci] 2023-09-28 20:14:35 +05:30
Eileen M. Uchitelle
9cb6f443d4
Merge pull request #49409 from stevepolitodesign/sp-datetime-local-scaffold
Ensure system test scaffold supports `datetime` and `time` attributes
2023-09-28 09:34:53 -04:00
Jean Boussier
a1c0173ee3 Move the database version cache from schema cache to pool config
Ref: https://github.com/rails/rails/pull/49378

As discussed with Matthew Draper, we have a bit of a chicken and egg
problem with the schema cache and the database version.

The database version is stored in the cache to avoid a query,
but the schema cache need to query the schema version in the database
to be revalidated.

So `check_version` depends on `schema_cache`, which depends on
`Migrator.current_version`, which depends on `configure_connection`
which depends on `check_version`.

But ultimately, we think storing the server version in the cache
is incorrect, because upgrading a DB server is orthogonal from
regenerating the schema cache.

So not persisting the version in cache is better. Instead we store
it in the pool config, so that we only check it once per process
and per database.
2023-09-28 15:18:38 +02:00
Jean Boussier
dfd086edf3 Fix RenderCallExtractor to be compatible with Ruby 3.3
Fix: https://github.com/rails/rails/issues/49128
Ref: https://github.com/ruby/ruby/commit/45cd011d73

We need to unwrap some nodes.
2023-09-28 14:35:01 +02:00
Petrik de Heus
6c9967f85a
Merge pull request #49413 from ghiculescu/document-retry-on
Document hierarchy for `retry_on` and `discard_on`
2023-09-28 07:34:06 +02:00
Petrik de Heus
a7041d3138
Merge pull request #49394 from johanstenberg92/fix-method-documentation-for-attempts-retry-on [ci skip]
Adjust method documentation for `ActiveJob::Exceptions::ClassMethods#retry_on`
2023-09-28 07:28:35 +02:00
Alex
bb8d6c9349 Document hierarchy for retry_on and discard_on
Fixes https://github.com/rails/rails/issues/49406
2023-09-28 15:00:29 +10:00
fatkodima
a7ee313d91 Enable raising when running rubocop-md against invalid ruby snippets 2023-09-27 23:12:48 +03:00
Rafael Mendonça França
7c03e4f1b7
Merge pull request #49175 from akhilgkrishnan/content_tag-html-tag-validation
HTML tag validation added for tag names
2023-09-27 13:37:41 -04:00