Commit Graph

9254 Commits

Author SHA1 Message Date
Hartley McGuire 8034cac675
Fix railspect not validating alphabetical order
One of the original goals of these checks was to validate that
configuration stays in alphabetical order, as this provides a
deterministic order for the configuration to be validated against.

However, it appears there has been a regression in that check and it has
only been validating that configurations are present. This commit
restores the ordering check and then uses `railspect configuration . -a`
to fix the configurations that ended up out of order.
2023-12-27 21:25:05 -05:00
Petrik de Heus e7f2db67ca
Merge pull request #50423 from p8/guides/link-to-query-matchers
Link to query assertions in testing guide [ci-skip]
2023-12-27 23:34:00 +01:00
fatkodima 17f5a8ce6f Add `schema_dump` docs to the multiple databases docs [skip ci] 2023-12-25 22:20:53 +02:00
fatkodima 1b2dcfbfe4 Remove setting `migrations_paths` for replicas from the docs [skip ci] 2023-12-25 14:59:52 +02:00
zzak 16ff9afb2e
Merge pull request #50275 from seanpdoyle/polymorphic-rename
Provide guidance for renaming classes in polymorphic associations [ci skip]
2023-12-25 08:01:15 +09:00
JohnAnon9771 c430cc3685 doc(active_record): adding more examples about scope control 2023-12-22 00:59:58 -03:00
Petrik 557dacfff9 Link to query assertions in testing guide [ci-skip]
We can link to the recenlty added queries as edge guides link to edge
API docs.
For readability the links are extracted.
2023-12-21 18:05:19 +01:00
fatkodima f48bbff32c Expose `assert_queries_match` and `assert_no_queries_match` assertions 2023-12-21 01:30:16 +02:00
Jonathan Hefner b0048c787a Capitalize "Rails" [ci-skip] 2023-12-19 13:16:47 -06:00
Hartley McGuire 1247932c80
Merge pull request #50360 from skipkayhil/hm-docs-deprecations
Improve Deprecation API docs and guide [ci-skip]
2023-12-17 17:10:21 -05:00
fatkodima a69228efa4 Fix `guides/active_record_migrations.rb` template to use the current migrations version 2023-12-17 11:36:10 +02:00
Hartley McGuire c7ff8b975b
Add sqlite3 back to bug templates that need it
The sqlite3 gem was removed during the merging of main and gem
templates, but the resulting templates still depend on it.
2023-12-17 00:10:22 -05:00
Sean Doyle fe2632f340 Add `actionview` bug report template
Introduce Action View bug report template for contributors to reproduce
issues with failing `ActionView::TestCase` instances.

In addition to rendering ERB with the `inline:` keyword, the sample
tests also include a `Helpers` module to demonstrate how to incorporate
view helpers into the reproduction script.
2023-12-16 10:16:10 -05:00
Jean Boussier 860ab28ff5
Merge pull request #50317 from zzak/consolidate-bug_reports
Consolidate bug_report_templates and remove the gem versions
2023-12-16 13:55:26 +01:00
Mike Kasberg 6fda7ade58 Document `action_mailer.file_settings` [ci-skip]
I was reading the Action Mailer guide and noticed the settings and
defaults for the `:file` delivery method were poorly documented. These
docs were originally added back in #13728. #44422 added links to the
relevant sections of the Configuration guide, but did not link
`config.action_mailer.file_settings` because the Configuration guide is
actually missing that section.

I added a short section to the Configuration guide for
`config.action_mailer.file_settings` and linked to it from the Action
Mailer guide, following the style of the other delivery methods. Like
other delivery methods, the relevant options for `file_settings` come
from the allowed options of the `Mail::FileDelivery` class in the mail
gem.

Here's where Rails sets up this delivery method with the default
location:
9064735ec5/actionmailer/lib/action_mailer/delivery_methods.rb (L30-L31)

And here's where the mail gem uses the options:
10a4443b9d/lib/mail/network/delivery_methods/file_delivery.rb (L21)
2023-12-15 08:31:07 -07:00
Hartley McGuire f93eb16564
Improve Deprecation API docs and guide
- Link to Deprecation::Behavior in configuring guide

  The current list of options for `config.active_support.deprecation`
  was missing the newly added `:report` option. Instead of adding the
  missing option and continuing to keep 4 different lists of the same
  options in sync, I opted to replace the list with a link to the
  options in the Behavior API docs. This had the additional advantage of
  giving more information about all of the options which was not
  mentioned in the Configuring guide.

- Use symbols for Behavior options

  It felt to me like naming the options did not make it explicit that
  those were the symbols to pass to `#behavior=`, but by adding the `:`
  that becomes more clear.

- Add some API links

  There were a few references to `behavior=`, but we may as well link to
  the actual method.
2023-12-14 17:10:44 -05:00
Emmanuel Hayford 03f2b75417 Document assert_queries and assert_no_queries [ci-skip] 2023-12-14 15:10:53 +01:00
Eugene Kenny 8278626a2c
Merge pull request #49297 from hannahramadan/main
Add instrumentation for ActionController::Live#send_stream
2023-12-13 08:38:59 +00:00
hramadan 6488bd9ec0 Add instrumentation for ActionController::Live#send_stream
Allows subscribing to `send_stream` events.
The event payload contains the filename, disposition, and type.
2023-12-13 08:19:48 +00:00
notapatch cfdf868f92 Update Rack::Head documentation to match code behavior
In commit 449039a86d,
ActionDispatch::Head was replaced with Rack::Head in the
middleware. However, the documentation was not changed.

Rack::Head code behaviour is not to change HEAD into GET it is to
close the body of all HEAD requests. This commit fixes the docs
to show this.

The left-over ActionDisplayt::Head documentation is,
unsurprisingly, wrong. Rack::Head code behaviour is not to change
HEAD into GET it is to close the body of all HEAD requests.

This commit fixes the docs to show this.
2023-12-12 21:08:56 +00:00
Hartley McGuire 5316432444
Merge pull request #50335 from takmar/fix-engines-documentation
[ci skip] Update outdated documentation for Engines
2023-12-12 00:02:14 -05:00
takmar ea49d27111 Update outdated documentation for Engines 2023-12-12 13:05:55 +09:00
Hartley McGuire b41aafee6c
Document :request in start_processing's payload 2023-12-11 19:05:33 -05:00
zzak b380da71b0
Consolidate bug_report_templates and remove the gem versions
As a contributor, changing a single line to test the desired version does not warrant a separate file for each type of report.

The only argument I can see for keeping the gem versions is that users are likely reporting a bug for a specific version of Rails, typically during an upgrade. As few people are probably testing their applications against Rails main branch.

Additionally, having the gem version templates means that we are testing both main and a stable release of Rails in CI, which has some benefit.
By removing the edge version templates, we also lose that coverage in CI, but I think it's something we can fix in buildkite-config to replace the line in those guides before running them later.

IMO, the cost of separate files and the confusion it will create if we want to add more templates outweighs the benefits mentioned here.

My motivation is that I want to add more report templates, like for additional adapters, and this list will grow to be unmanageable if we keep the gem versions.
2023-12-12 07:06:29 +09:00
Ricardo Elisiário f9e21c5616
refactor: fix typo 2023-12-11 19:53:39 +00:00
Aaron Patterson 759ae9052c
Merge pull request #49472 from mateusdeap/main
[ci skip] Change `resourceful` to `resource` for clarity
2023-12-11 09:04:27 -08:00
r7kamura f06189862d Fix wrong example code: `active_job.message_serializer` 2023-12-11 14:11:29 +09:00
jbk2 3da041ef52
Correct HAVING conditions active_record example query
Correct the active_record query example, in the HAVING conditions section, to align with the corresponding given SQL output.
2023-12-08 17:26:59 +01:00
Sean Doyle 0d8b3f09af Provide guidance for renaming classes in polymorphic associations [ci skip]
Add guidance to the Association Basics and `.belongs_to` method
documentation to encourage the renaming of a model's Ruby class to
coincide with updates to the existing data in the database.

Since Action Text and Active Storage rely on polymorphic associations,
add similar warnings to their guides.

Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Stephen Hanson <s.hanson5@gmail.com>
Co-authored-by: zzak <zzakscott@gmail.com>
2023-12-08 09:19:21 -05:00
Petrik f30c097525 Remove some outdated security advice from Security guide [ci-skip]
Upgrading Rails to "at least 2.1.1" is outdated advice. Applications
should run 7.0.Z or 7.1.Z.
Also, RedCloth version 4 is from 2009, so I don't think it's that "new".
2023-12-08 10:15:23 +01:00
Hartley McGuire f0d66d6c47
Merge pull request #50279 from skipkayhil/hm-nfd-2
More improvements to new framework defaults doc [ci-skip]
2023-12-07 17:37:00 -05:00
Jean Boussier 745992e93e
Merge pull request #49640 from mguan2020/branch_new
Added link further explaining ERB in the 'Getting Started' documentation [ci skip]
2023-12-07 08:02:38 +01:00
Hartley McGuire d3d327bb43
More improvements to new framework defaults doc
- Explain the purpose of wrap_parameters_by_default and how it replaces
  the wrap_parameters initializer.
- Explain why action_mailer.smtp_timeout exists and why its useful
- Add example to action_view.button_to_generates_button_tag
2023-12-05 19:08:54 -05:00
Hartley McGuire c057edaaad
Merge pull request #50277 from skipkayhil/hm-nfd-open-redirects
Improve doc for raise_on_open_redirects [ci-skip]
2023-12-05 17:38:31 -05:00
Hartley McGuire 8f1b3ceb7e
Fix link to config.active_record.protocol_adapters 2023-12-05 17:15:17 -05:00
Hartley McGuire ecbe5f9bfe
Improve doc for raise_on_open_redirects
- provide a definition for an "open redirect"
- clarify what "permitted open redirect" means in this context
2023-12-05 17:10:55 -05:00
Akhil G Krishnan cc55785f4d Add actionview deprecation to 7.2 release note 2023-12-04 22:41:10 +05:30
Jean Boussier a35ceb429c
Merge pull request #50262 from Techbrunch/patch-1
Use RedCloth GitHub instead of an expired domain
2023-12-04 16:52:58 +01:00
Jean Boussier 439e8be98e
Merge pull request #50217 from fastjames/document_variant_preprocessed_option
Document the `preprocessed` variant option [ci skip]
2023-12-04 16:49:05 +01:00
Jim Kane 87c614a1d4 Document the `preprocessed` variant option 2023-12-04 09:21:01 -06:00
Techbrunch a86e8c875a
Use RedCloth GitHub instead of an expired domain 2023-12-04 14:44:30 +01:00
yysaki 7f94cb9483 Update security.md typo about HTTP Strict-Transport-Security [ci-skip] 2023-12-02 17:23:23 +09:00
Adrianna Chang 2854e378c8
Revert "Add config for validating migration timestamps" 2023-12-01 11:58:53 -05:00
Eileen M. Uchitelle c60d064fd5
Merge pull request #50205 from rails/ac-validate-migration-timestamps
Add config for validating migration timestamps
2023-11-30 16:20:49 -05:00
Adrianna Chang 06575d1d75
Add `active_record.config.validate_migration_timestamps` option.
When set, validates that the timestamp prefix for a migration is in the form YYYYMMDDHHMMSS.
This is designed to prevent migration timestamps from being modified by hand.

It is turned off by default.
2023-11-30 16:04:06 -05:00
Jean Boussier da2dbbb292
Merge pull request #50157 from Earlopain/update-erb-trim-mode-docs
Update docs for `erb_trim_mode`
2023-11-30 19:15:43 +01:00
Jean Boussier 9c22f35440
Merge pull request #50140 from kmcphillips/ar-protocol-adapter
Add a `ActiveRecord.protocol_adapters` configuration to map `DATABASE_URL` protocols to adapters at an application level
2023-11-29 17:41:51 +01:00
jbk2 aa688c1d31
Update form_helpers.md
Correcting book[title] value typo on line 265 in order that it correctly reflects it's object value stated in line 248.
2023-11-29 14:08:49 +01:00
Kevin McPhillips 0ccf300add Add an `ActiveRecord.protocol_adapters` configuration which maps the protocol in a `DATABASE_URL` to a database adapter. 2023-11-28 20:23:58 -05:00
“Apoorv d7b212626b add missing preposition in sentence 2023-11-27 22:01:07 +05:30
Earlopain 7aab98a16e
Update docs for erb_trim_mode [ci-skip] 2023-11-24 12:54:34 +01:00
Jonathan Hefner f1d3acedb5 Include Preview#url in service_urls_expire_in list [ci-skip] 2023-11-23 11:52:39 -06:00
Jonathan Hefner 252cc95d12 Link to API docs [ci-skip] 2023-11-23 11:51:49 -06:00
Jonathan Hefner 54dc0b306a Link to api.rubyonrails.org instead of edgeapi [ci-skip] 2023-11-23 11:13:15 -06:00
Vipul A M 408faa2d42
Merge pull request #49743 from yoshixi/improve-action-mailbox-incineration-doc-1
Improve docs for the action-mail box incineration
2023-11-23 18:23:31 +05:30
Rafael Mendonça França 03dae98092
Remove deprecated `:exponentially_longer` value for the `:wait` in `retry_on` 2023-11-22 22:13:59 +00:00
Rafael Mendonça França 798289699d
Remove deprecated support to set numeric values to `scheduled_at` attribute 2023-11-22 22:13:06 +00:00
Rafael Mendonça França 2a761d23d2
Remove deprecated primitive serializer for `BigDecimal` arguments 2023-11-22 22:13:03 +00:00
Rafael Mendonça França ec2c2666c2
Remove deprecated support to set `Rails.application.config.action_dispatch.show_exceptions` to `true` and `false` 2023-11-22 22:12:10 +00:00
Rafael Mendonça França 30193dc087
Remove deprecated `speaker`, `vibrate`, and `vr` permissions policy directives 2023-11-22 22:12:09 +00:00
Rafael Mendonça França d088d9132f
Remove deprecated `Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type`. 2023-11-22 22:12:08 +00:00
Rafael Mendonça França 43e42c1ea8
Remove deprecated comparison between `ActionController::Parameters` and `Hash` 2023-11-22 22:12:07 +00:00
Rafael Mendonça França 87bc1190fb
Remove deprecated constant `AbstractController::Helpers::MissingHelperError` 2023-11-22 22:12:03 +00:00
Rafael Mendonça França b2f96d07d4
Remove deprecated constant `ActionDispatch::IllegalStateError` 2023-11-22 22:11:43 +00:00
Rafael Mendonça França 992a126c6e
Remove deprecated params via `:args` for `assert_enqueued_email_with` 2023-11-22 22:11:32 +00:00
Rafael Mendonça França 2bd6cf5177
Remove deprecated `config.action_mailer.preview_path` 2023-11-22 22:11:31 +00:00
Vipul A M 21b72e437e
Merge pull request #49925 from akhilgkrishnan/add-missing-methods-in-view-helper-guide
Add missing audio_tag, favicon_link_tag, video_tag methods in ActionView helper guide [ci skip]
2023-11-20 17:57:17 +05:30
Akhil G Krishnan d08c2c74eb Document docker related files in app folder structure 2023-11-19 10:31:11 +05:30
Akhil G Krishnan cf605cd05b Add missing audio_tag, favicon_link_tag, video_tag methods in ActionView helper guide
Requested changes updated
2023-11-18 22:09:39 +05:30
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
sid-707 781faa1304 Fix grammar to aid readibility 2023-11-13 22:52:25 -05:00
Vipul A M 4cc1de7910
Merge pull request #50022 from akhilgkrishnan/update-rails-about-content 2023-11-13 01:27:30 +05:30
Hartley McGuire c95dad5657
Improve `set_load_path` documentation
The new documentation explicitly lists all "autoload paths" for the
reader, and mentions the `add_autoload_paths_to_load_path` config toggle

Co-authored-by: Matt <iMacTia@users.noreply.github.com>
2023-11-12 14:16:36 -05:00
Akhil G Krishnan 68d39cb1c8 Updated rails about guide content with latest data
requested changes updated
2023-11-13 00:11:59 +05:30
Hartley McGuire 09d51c93e7
Merge pull request #49979 from ttanimichi/patch-2
Not only `save(validate: false)` but also `save!(validate: false)` triggers callbacks
2023-11-12 12:42:48 -05:00
Guillaume Wrobel 07ed4f87e4
Add picture_tag to ActionView helpers guides [ci skip] 2023-11-11 18:18:30 +01:00
Akhil G Krishnan 698de01b64 Remove config.load_paths reference from guide 2023-11-11 11:40:13 +05:30
Sean Doyle 8c593873a5 Add `actionmailer` bug report template
Introduce Action Mailer bug report templates for contributors to reproduce
issues with failing `ActionMailer::TestCase` instances.
2023-11-10 12:03:28 -05:00
Y.I 10e0bddf01
[ci skip] Typo 2023-11-10 13:51:15 +02:00
Hartley McGuire e43471a80d
Merge pull request #49985 from kuranari/update-redis-cache-store-options
Update ActiveSupport::Cache::RedisCacheStore documentation [ci skip]
2023-11-09 11:05:08 -05:00
Tomohisa Kuranari d4025ab1fe Update ActiveSupport::Cache::RedisCacheStore documentation
For more info:
* https://github.com/rails/rails/issues/46149
* https://github.com/rails/rails/pull/46204
2023-11-09 23:52:00 +09:00
Aashish Saini a109b9f06a Add missing preload_link_tag in ActionView helper guide 2023-11-09 20:19:34 +05:30
Tsukuru Tanimichi a89acde9ba
Not only `save(validate: false)` but also `save!(validate: false)` triggers callbacks
```
$ cat app/models/item.rb
class Item < ApplicationRecord
  after_save { puts 'Item saved' }

  validates :name, presence: true
end

$ bin/rails r 'Item.new.save(validate: false)'
Item saved

$ bin/rails r 'Item.new.save!(validate: false)'
Item saved

$ bin/rails r 'Item.new.save!'
/Users/ttanimichi/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.1/lib/active_record/validations.rb:84:in `raise_validation_error': Validation failed: Name can't be blank (ActiveRecord::RecordInvalid)
```
2023-11-09 15:42:08 +09:00
yoshiki masubuchi 2655cad028 Improve action_mailbox_basics.md 2023-11-06 08:48:55 +09:00
Akhil G Krishnan a60e1a2380 API documentation reference added to view helper 2023-11-05 09:23:30 +05:30
mguan2020 1ca27cc4ab Documented a breaking change regarding imports in @rails/ujs 7.1.0 2023-11-04 17:51:56 +00:00
Petrik a904df9087 Move the association callbacks section to the callbacks guides [ci-skip]
Association callbacks were missing in the callbacks guide.
We can still keep a small section in the associations guide that links
to the callbacks guide.
2023-11-03 22:29:39 +01:00
Masahito Osako 9a1d027c97 Update new nodejs installation method in development_dependencies_install document.
Because the traditional `setup_XX.x` script is deprecated, and there is a need to migrate to the new installation method.
2023-11-03 22:03:51 +09:00
Petrik de Heus bbc6230ae7
Merge pull request #49888 from p8/guides/ar-callbacks-ordering
Expand the transaction callback ordering in guides [ci-skip]
2023-11-02 10:26:13 +01:00
Petrik 14acab20a2 Expand the transaction callback ordering in guides [ci-skip]
The ordering can now be configured.

Also update the Configuring guide and API docs. In the Configuring guide
"When true" seems more common than "When false", so that is used
instead.

Co-authored-by: Akhil G Krishnan <akhilgkrishnan4u@gmail.com>
2023-11-02 10:16:35 +01:00
Gannon McGibbon d716e6dbcc Document async option in guides for query.active_record events
Related to #load_async queries added in #40037 #41372.
2023-11-02 01:11:58 -05:00
Petrik 5b6f422c2b Clarify transaction callbacks section [ci-skip]
Rename "Dealing With Consistency" heading to "`after_commit` and
`after_rollback`. To be more inline with other headings.

The "Context Matters" heading has been renamed to "Aliases for
`after_commit`", as this section is about aliases and `Context Matters` is
a bit ambiguous.

The warnings for `after_commit` and `after_rollback` better fit with the
section about these callback methods.
2023-11-01 14:38:07 +01:00
Petrik 3393afba59 Move new warning after example of previous wanring [ci-skip] 2023-11-01 14:14:32 +01:00
Adrianna Chang 1370d043b9
Merge pull request #49831 from dhavalsingh/update_callback_docs_for_same_model_multi_instance
Update Callbacks Documentation: Specify 'after_commit' and 'after_rollback' Behavior for Multiple Objects of the Same Record [ci skip]
2023-11-01 08:42:55 -04:00
fatkodima 21d6be0dd7
Merge pull request #49882 from a5-stable/add-zettabyte-doc
Add zettabytes documentation to the guide [skip ci]
2023-11-01 12:05:28 +02:00
fatkodima 83b38751c5
Merge pull request #49880 from akhilgkrishnan/remove-period-from-title
Remove period from title [skip ci]
2023-11-01 12:02:37 +02:00
Dhaval 2e6f1dcf95 Update Callbacks Documentation: Clarify commit callback behavior with multiple instances of the same model
updated warnign to be more clear

Update Callbacks Documentation: Clarify commit callback behavior
2023-11-01 14:25:54 +05:30
a5-stable 12080ee097 update zettabytes doc 2023-11-01 16:47:35 +09:00
Akhil G Krishnan 61317a500d Typo fix: updates the rails version 2023-11-01 09:27:57 +05:30
Akhil G Krishnan 054684537e Remove period from title 2023-11-01 09:11:14 +05:30
zzak f522f99f11
Set load_defaults to current Rails version in bug_report_templates
Currently only Action Mailbox and Active Storage use initialized apps, so at least in those cases we can ensure the correct defaults are used by bug reporters.
2023-10-31 17:54:35 +09:00
Sean Doyle 591d88aef4 Document Action Text Sanitization
Add documentation for `ActionText::RichText#to_s` and
`ActionText::Content#to_s` that demonstrates Action Text's ability to
sanitize and scrub its content.

Co-authored-by: Mike Dalessio <mike.dalessio@gmail.com>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
2023-10-30 17:49:13 -04:00
Eileen M. Uchitelle 9483a19bcd
Merge pull request #49850 from ansonhoyt/document-active_record-strict_loading_violation_error
Improve `strict_loading` documentation [ci skip]
2023-10-30 14:48:43 -04:00
Anson Hoyt 51011701e3 Improve `strict_loading` documentation [ci skip]
* Update ActiveRecord::StrictLoadingViolationError API docs to
  reference the guide to help beginners learn how to resolve the error.
* Update Active Record Query Interface guide to cover configuration and
  the association option.

Apply suggestions from code review

Co-authored-by: Eileen M. Uchitelle <eileencodes@users.noreply.github.com>
2023-10-30 18:17:26 +00:00
Adrian Hirt 571f8a417c Update text for config.public_file_server.enabled [ci-skip]
Update the text for config.public_file_server.enabled in the configuring guide as PR #47137 turned on static file server by default for all environments.

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2023-10-30 12:30:33 -05:00
Jean Boussier c28e4f2434 Use double quotes more consistenly in doc and error messages
For better or worse, the Rails guide settled on double quotes
and a large part of the community also use rubocop which enforce
them by default.

So we might as well try to follow that style when providing code
snippets in the documentation or error messages.

Fix: https://github.com/rails/rails/issues/49822

I certainly didn't get them all, but consistency should be significantly
improved.
2023-10-28 11:38:49 +02:00
Yasuo Honda 6c63b9b090
Merge pull request #49187 from ccutrer/defer-constraints
Add `set_constraints` helper for PostgreSQL
2023-10-28 14:40:24 +09:00
Rafael Mendonça França 421df52bf8
Merge pull request #49760 from akhilgkrishnan/remove-broken-link
Remove rails guides translation references [ci skip]
2023-10-27 17:23:28 -04:00
Rafael Mendonça França 403447d061
Use version of importmap that support loading outside of an app
We are using it in a few scripts, and we were doing workarounds
to be able to use outside an Rails application.

Now the workaround is gone.
2023-10-27 20:23:42 +00:00
Akhil G Krishnan b3aaa58d18 Remove rails guides translation references [ci skip] 2023-10-27 21:32:23 +05:30
Earlopain 19fea569b9
Remove note about inline changelog credit in contributing guide
[ci-skip]
2023-10-26 14:48:31 +02:00
mguan2020 afa59c3386 Add link providing more details about ERB in the 'Getting Started' documentation [ci skip]
Co-Authored-By: Akhil G Krishnan <akhilgkrishnan4u@gmail.com>

Add link providing more details about ERB in the 'Getting Started' documentation [ci skip]

Co-Authored-By: Akhil G Krishnan <akhilgkrishnan4u@gmail.com>

Fix link to point to html [ci skip]

Co-authored-by: Rafael Mendonça França <rafael@franca.dev>

Revert "Merge branch 'branch_new' of https://github.com/mguan2020/rails into pr/49640"

This reverts commit 94b8c7d579a74c528c4a85f3ce0f0853c4883fd1, reversing
changes made to 1353ca902f260dfb9bbe7680ede2650a670f659f.

Revert "Revert "Merge branch 'branch_new' of https://github.com/mguan2020/rails into pr/49640""

This reverts commit e9ced85c8f6afe0bc057bc6d8d4387718a7c3916.
2023-10-25 21:04:26 +00:00
Steve Polito ef299a5656 Replace `:disabled` with `nil`
If there's a column named `disabled`, we'll still raise
`ActiveRecord::SubclassNotFound`. Setting `inheritance_column` to `nil`
works though.

I had mistakenly thought `:disabled` was the correct way to disable STI,
since this is what is done in [some tests][].

```ruby
Schema: cogs[ id, type, disabled, created_at, updated_at ]

class Cog < ApplicationRecord
  self.inheritance_column = nil
end

Cog.create! type: "Sprocket", disabled: true
=> #<Cog type: "Sprocket", disabled: "t">
```

[some tests]: a4751751bc/activerecord/test/models/post.rb (L231)
2023-10-25 13:36:57 -04:00
Steve Polito fcc000ce14 Improve STI documentation
Add new sections to [STI Guides][] demonstrating how to override or
disable the [inheritance_column][].

Also improve error message when `ActiveRecord::SubclassNotFound` is
raised.

[STI Guides]: https://guides.rubyonrails.org/association_basics.html#single-table-inheritance-sti
[inheritance_column]: https://api.rubyonrails.org/classes/ActiveRecord/ModelSchema.html#method-c-inheritance_column
2023-10-25 13:24:46 -04:00
Adrianna Chang 02fa5c2288
Merge pull request #49712 from MatheusRich/mr/docs-for-action-mailer-asset-host
[ci skip] Update Action Mailer guide on how to add images
2023-10-25 09:37:36 -04:00
Matheus Richard f18e3d382a Update Action Mailer guide on how to add images
Unlike controllers, mailers can't infer the protocol from the request,
so users need to specify it.
2023-10-25 10:25:59 -03:00
Cody Cutrer f9fee1a3cb Add `set_constraints` helper for PostgreSQL
The docs already talk about how to set up deferrable constraints, but
then rely on the user crafting custom SQL to actually use the feature.
The helper makes it easier to handle juggling multiple specific
constraints and quoting issues.
2023-10-24 11:49:11 -06:00
Mathieu Le Tiec 796eb66445
Clarify ActiveModel::SecurePassword maximum password length
Since 74264f4 improved the secure_password length validation to match bcrypt limit, this validation can be described more accurately in the ActiveModel basics guide.
2023-10-24 10:24:38 +02:00
Rafael Mendonça França 7937092b3e
Merge pull request #49723 from mylesboone/activestorage_touch_config
Add config option to not touch records
2023-10-23 13:56:02 -04:00
Petrik de Heus 2a5666ae11
Merge pull request #49729 from joshuay03/add-discord-link-to-contributing-guide
Add Discord invite link to contributing guide
2023-10-21 14:03:05 +02:00
Xinqi Mu 6dd1f87e26
Fix factually incorrect SQL statements 2023-10-21 18:40:45 +08:00
Joshua Young 1fb96f0856 Add Discord invite link to contributing guide 2023-10-21 16:14:17 +10:00
Hartley McGuire 92fb75e46a
Add release note for alias_attribute deprecation
Ref eae26caec3
2023-10-20 18:49:09 -04:00
Di Wu f48c3ad9e8
Update broken links in testing.md on Setting Header And CGI Variables (#49725)
* Update broken links in testing.md

The HTTP headers and CGI variables section had broken links. Updated these to direct to the correct locations on datatracker.ietf.org.

* Update to Point to correct section 4.1
2023-10-20 17:59:02 -04:00
Myles Boone 13d66b1632 Add config option to not touch records
ActiveStorage::Attachment records are not directly maintained by
ActiveStorage and it may not be feasible or desired to update the record
when its attachment is saved.
2023-10-20 14:41:57 -04:00
Aitor García Rey 4a3e51a840
Update classic_to_zeitwerk_howto.md
Some typos were fixed on the Zeitwerk migration guide.
2023-10-17 18:54:58 +02:00
Sean Doyle 8ecbdb3dbc Fix failing linter in `guides/source`
Fix [Failing CI Lint][]

Adds a missing comma to make an example Ruby block syntactically valid.

[Failing CI Lint]: https://github.com/rails/rails/actions/runs/6539678344/job/17758241844?pr=49486#step:4:12
2023-10-16 23:00:58 +01:00
eileencodes 0b1a6d76ac
[ci skip] Fix shard docs followup
Oops, the ShardRecord needs to be an abstract class and
ApplicationRecord needs to be a primary_abstract_class
2023-10-16 17:09:46 -04:00
eileencodes 35e0ae4337
[ci skip] Fix shard docs
We never explained how migrations paths work for shards. This fixes that
and also adds the appropriate class setup. You no longer need to set a
`default` shard as of #48353. In addition, `ApplicationRecord` should be
used for the non-sharded db that also serves as the tenant/shard router.
Then shards should get their own connection class since the schema
differs.
2023-10-16 17:02:11 -04:00
Rafael Mendonça França 2872d55a3b
Revert "Add psych to the bug report template"
This reverts commit e4e242685e.

This doesn't solve the problem.
2023-10-16 15:26:13 +00:00
Rafael Mendonça França e4e242685e
Add psych to the bug report template
With release of psych 5.1.1.1 bundler doesn't know which version to
load.

https://buildkite.com/rails/rails/builds/100852
2023-10-16 14:14:21 +00:00
Ryuta Kamizono 53438e9216
Merge pull request #49632 from zzak/bug_report_templates/unfreeze_rack
Revert "Freeze rack in 2.0 for guides bug report templates"
2023-10-15 12:40:51 +09:00
Dustin Brown c11c5cb482 Fix code blocks that caused lint failures 2023-10-14 17:02:19 +00:00
Rafael Montas dd8f6e5cbb Fix typo in configuring guide 2023-10-14 12:59:35 +00:00
zzak a03200460e
Revert "Freeze rack in 2.0 for guides bug report templates"
This reverts commit c5ace249e7.

Since this commit support for Rack 3 has stabilized.
2023-10-14 09:23:28 +09:00
Rafael Mendonça França 653725ee7c
Merge pull request #49610 from ezekg/fix/note-on-rails-7-1-sha-1-bug
Add note on active_record.encryption.support_sha1_for_non_deterministic_encryption
2023-10-13 17:14:47 +02:00
Edward Tippett 2130d523b4 Use correct tense of `cast` for guides
Switch to `cast` for describing the past tense actions.

`casted` is a common mistake, but not correct English.
2023-10-13 13:07:07 +10:30
paulreece f5668a0b18 Just clarifies a little the bun installation process and gives people instructions what to do if it did not install. 2023-10-12 18:01:38 -04:00
Zeke Gabrielse 88ed242498 Add note on support_sha1_for_non_deterministic_encryption 2023-10-12 14:37:30 -05:00
Carlos Antonio da Silva bbf4fc9efb
Merge pull request #49603 from y0608/patch-1
Fix broken link in AR validations guide [ci skip]
2023-10-12 10:44:16 -03:00
Carlos Antonio da Silva 837b8d992c
Merge pull request #49602 from Earlopain/49600-followup
Update filter_parameters default in configuring guide [ci skip]
2023-10-12 10:40:59 -03:00
Y.I bb638b4143
Typo: broken link 2023-10-12 16:30:14 +03:00
Earlopain 227aa4e8c0
Update filter_parameters default in configuring guide [ci skip] 2023-10-12 14:45:55 +02:00
Carlos Antonio da Silva 5103ab167e Fix numbered list and indentation of code blocks on upgrade guide
Otherwise they are considered separate lists instead of a sequence
within the same list. This also renders the code block with extra
indent, as part of the item they belong to.

Also use `Active Record Encryption` with capital letters consistently.

[ci skip]
2023-10-12 08:46:39 -03:00
Jonathan Hefner d7aee014cb Fix monospace formatting [ci-skip] 2023-10-11 23:51:34 -05:00
Jonathan Hefner 5021b46396 Remove unnecessary monospace formatting [ci-skip] 2023-10-11 23:47:52 -05:00
John Bampton 6cd5254111 guides/source/asset_pipeline.md: fix spelling 2023-10-12 13:54:00 +10:00
Rafael Mendonça França 90a6f3663b
Merge pull request #49587 from jdelStrother/patch-2
Advise upgraders to set active_record.encryption.hash_digest_class
2023-10-12 01:12:36 +02:00
Jonathan del Strother 5f68493cda
Advise upgraders to set active_record.encryption.hash_digest_class
This is currently documented in new_framework_defaults, but deserves highlighting more explicitly to help anyone upgrading from older versions.
2023-10-11 22:51:59 +00:00
Rafael Mendonça França 7228da34b9
Merge pull request #49532 from akhilgkrishnan/base-template-for-7-2-release-note
Added base template for rails 7.2 release note [skip ci]
2023-10-11 23:03:13 +02:00
Rafael Mendonça França 2f853e6bed
Merge pull request #49585 from akhilgkrishnan/update-7-1-to-7-2
Updated the rails version in 7.1 to 7.2 in guide [skip ci]
2023-10-11 22:01:30 +02:00
Carlos Antonio da Silva c8c95f424e
Merge pull request #49580 from p8/guides/format-html-attributes
Recommend fixed-width fonts for HTML and CSS as well in documentation [ci-skip]
2023-10-11 14:23:27 -03:00
Rafael Mendonça França 452c9f6c71
Merge pull request #49538 from akhilgkrishnan/capitalize-framework-names
Capitalize framework names [skip ci]
2023-10-11 17:04:27 +02:00
Akhil G Krishnan 41e86d4286 Updated the rails version in 7.1 to 7.2 in guide [skip ci] 2023-10-11 20:26:23 +05:30
Eileen M. Uchitelle bfd981ebb4
Merge pull request #49539 from akhilgkrishnan/docs-update-7-0-to-7-1
Updated the rails version in 7.0 to 7.1 in guide [skip ci]
2023-10-11 10:17:44 -04:00
Akhil G Krishnan 72fae17f92 Updated the rails version in 7.0 to 7.1 in guide [skip ci] 2023-10-11 19:45:22 +05:30
Ryuta Kamizono 7514031eeb
Merge pull request #49582 from fatkodima/enable-RedundantDoubleSplatHashBraces-cop
Enable `Style/RedundantDoubleSplatHashBraces` rubocop cop
2023-10-11 22:39:55 +09:00
fatkodima b8829cabec Enable `Style/RedundantDoubleSplatHashBraces` rubocop cop 2023-10-11 14:55:00 +03:00
hachi8833 0df2c25479 Update guide: NPM -> npm 2023-10-11 19:07:50 +09:00
Petrik 79f5588d33 Recommend fixed-width fonts for HTML and CSS as well in docs [ci-skip] 2023-10-11 11:20:11 +02:00
Sébastien Dubois 6eeb128e60 Explain how to configure collection cache key 2023-10-11 09:54:54 +02:00
Jonathan Hefner 8776e951f2
Merge pull request #49556 from mguan2020/my_new_branch
Fixed formatting in Action Text documentation to make it more consistent. [ci skip]
2023-10-10 23:06:26 -05:00
John Bampton 7ee9306bb7 guides/source/asset_pipeline.md: change `Javascript` to `JavaScript` 2023-10-11 09:18:36 +05:30
John Bampton bc41113fc9 guides/source/configuring.md: fix grammar and spelling 2023-10-11 09:18:36 +05:30
Akhil G Krishnan cf61804fd4 Update postgres naming to PostgreSQL 2023-10-11 09:18:36 +05:30
John Bampton 10bd1d8d23 guides/source/asset_pipeline.md: change `Javascript` to `JavaScript` 2023-10-11 08:13:16 +10:00
John Bampton ecac7d6d4e guides/source/configuring.md: fix grammar and spelling 2023-10-11 07:04:34 +10:00
Carlos Antonio da Silva c7e3cf2561
Merge pull request #49562 from akhilgkrishnan/update-postgres-naming-to-postgresql
Update postgres naming to PostgreSQL
2023-10-10 15:51:45 -03:00
hachi8833 4d4f80d2c1 Update raise_on_open_redirects config with table style 2023-10-10 19:38:10 +09:00
Akhil G Krishnan 80a5fb50c2 Update postgres naming to PostgreSQL 2023-10-10 13:44:20 +05:30
hachi8833 8763271aef Add raise_on_missing_callback_actions to configuring guide 2023-10-10 11:22:10 +09:00
mguan2020 643484922d Fixed formatting of 'contenteditable' and 'execCommand' in the Action Text guide to make it more consistent with the rest of the documentation.
Detail:
This Pull Request modifies the documentation of Action Text so that all instances of 'contenteditable' and 'execCommand' are now in a code block. This makes the documentation more readable for users.
2023-10-09 22:34:08 +00:00
Xavier Noria 785b2c29cd Fix example in Active Storage guide
url_for returns a URL, not a path. Also, as the text says,
that URL points to the redirect controller, the "/redirect"
segment was missing.
2023-10-09 17:17:28 +02:00
Akhil G Krishnan 73b2ae04fe Point to Guide instead of edge [skip ci] 2023-10-09 19:58:56 +05:30
Carlos Antonio da Silva e3e0c646ab Point to API docs instead of edge [ci skip] 2023-10-09 10:19:38 -03:00
Akhil G Krishnan c96695dfcf Capitalize framework names 2023-10-08 11:34:21 +05:30
Hartley McGuire ce86940744
Update gem bug report templates to 7.1 2023-10-07 20:49:14 -04:00
fatkodima 961fc42f90
Merge pull request #49533 from akhilgkrishnan/release-note-typo-fix
Typo: Updated the rails version in rails 7.2 release note [skip ci]
2023-10-07 21:22:05 +03:00
Akhil G Krishnan 6df831a5c6 Typo: Updated the rails version in rails 7.2 release note [skip ci] 2023-10-07 23:12:40 +05:30
Akhil G Krishnan 8a67e18d6c Added base template for rails 7.2 release note [skip ci] 2023-10-07 23:05:53 +05:30
Jonathan Hefner ff191cebe5 Simplify up / down migration example [ci-skip]
Follow-up to #47782.

These examples merely illustrate the order of execution when using `up`
and `down`, so we only need one operation before and after.
2023-10-07 12:26:26 -05:00
Jonathan Hefner 400d9d498b Add missing caveats for migration #change actions [ci-skip] 2023-10-07 12:26:26 -05:00
Jonathan Hefner a89412b362 Remove redundant caveat for remove_column [ci-skip] 2023-10-07 12:26:26 -05:00
Jonathan Hefner 8d0748e6b0 Rewrite Testing Jobs section [ci-skip]
This simplifies the prose and code examples, and links to more API docs.
2023-10-07 12:26:26 -05:00
Jonathan Hefner ed08eea99f Capitalize framework names [ci-skip] 2023-10-07 12:26:26 -05:00
Jonathan Hefner 4c2fdbfac5 Move Server Timing info to Configuration guide [ci-skip]
Follow-up to #48221.

The Active Support Instrumentation guide is about the
`ActiveSupport::Notifications` API.  Therefore, move the information
about `config.server_timing` and the `ActionDispatch::ServerTiming`
middleware to the existing sections in the Configuration guide.
2023-10-07 12:26:21 -05:00
Jonathan Hefner 6df4d3b6ff Fix punctuation and formatting [ci-skip] 2023-10-07 12:02:23 -05:00
Jonathan Hefner 9418b34e7d Reword "Regarding the Rails Stack" section [ci-skip] 2023-10-07 12:02:23 -05:00
Jonathan Hefner ce019f1241 Reword "Method Visibility" section [ci-skip]
For clarity and brevity.
2023-10-07 12:02:23 -05:00
Jonathan Hefner eabc003f8e Link to api.rubyonrails.org instead of edgeapi [ci-skip] 2023-10-07 12:02:22 -05:00
Jonathan Hefner 76ef648858 Rewrap documentation example for legibility [ci-skip] 2023-10-07 12:02:22 -05:00
Jonathan Hefner 0e908bb5ef Use ruby code fence [ci-skip]
These examples show RDoc in the form of Ruby comments, and should
therefore use the `ruby` code fence (which matches the other examples in
this guide).
2023-10-07 12:02:22 -05:00
Jonathan Hefner 8447a72948 Convert examples from Markdown to RDoc [ci-skip]
This guide is about API documentation which uses RDoc, so we should
avoid Markdown syntax in examples.
2023-10-07 12:02:22 -05:00
Jonathan Hefner e8166c4c70 Hyphenate "database specific" [ci-skip]
"database-specific" is a compound adjective, and thus hyphenated.
2023-10-07 12:02:22 -05:00
Jonathan Hefner 29b32216ff Link to ActionDispatch::DebugExceptions API doc [ci-skip]
This also adds missing punctuation and formatting.
2023-10-07 11:55:35 -05:00
Jonathan Hefner 3534c40c33 Move example to API docs [ci-skip] 2023-10-07 11:55:34 -05:00
Jonathan Hefner d81019eb40 Link to API docs [ci-skip] 2023-10-07 11:52:34 -05:00
Edouard CHIN 8be0c10c48 Add doc to explain how to migrate to the new BroadcastLogger:
- This should make it easier for apps or libraries that were
  previously relying on the private API.
  Also took the opportunity to tweak the doc of the BroadcastLogger
  to mention what happens when calling a non-standard method.

  Fix #49494
2023-10-07 14:43:46 +02:00
hachi8833 232f237589 Update changelog links to 7-1-stable 2023-10-06 18:05:21 +09:00
Rafael Mendonça França 2d271a4b90
Merge pull request #49491 from tnir/tn-date-rails71
Add corrected release month for Rails 7.1
2023-10-05 08:01:36 +00:00
Rafael Mendonça França 2974362b3f
Add release month for Rails 7.1
We know we are going to release this month.
2023-10-05 07:59:58 +00:00
hachi8833 9c421dde8c Fix heading in migration guide 2023-10-04 20:20:10 +09:00
hachi8833 ffee8a0aa2 Add description for db:prepare
Review by ChatGPT

Minor fix on db:prepare document

Update by review

Add hard wrap
2023-10-04 19:04:09 +09:00
Sean Doyle bff95987ef Resolve Upgrading Rails lint violation
Follow-up to [#49474][]

Execute documentation change in CI so that the linters can scan the
documentation's code blocks.

[#49474]: https://github.com/rails/rails/pull/49474#issuecomment-1745519821
2023-10-03 14:42:13 -04:00
Petrik de Heus d7e401d752
Merge pull request #49474 from seanpdoyle/upgrading-action-view-rendered
Document how to upgrade to `ActionView::TestCase#rendered` [ci skip]
2023-10-03 20:20:27 +02:00
Sean Doyle 5243fd302b Document how to upgrade to `ActionView::TestCase#rendered` [ci skip]
Based on a [comment on #49194][], describe how to achieve backwards
compatibility with existing `ActionView::TestCase` definitions.

[comment on #49194]: https://github.com/rails/rails/pull/49194#discussion_r1337832295
2023-10-03 13:43:11 -04:00
Mateus Pereira 2b38f2b954 Change `resourceful` to `resource` for clarity 2023-10-03 10:28:28 -03:00
Steve Polito 96a9570a26 Update links in Generator Guides
Link to `Rails::Generators::Testing::Behavior` instead of
`Rails::Generators::Testing::Behaviour` in an effort to ensure the Edge
Guides link to the correct API documentation.
2023-10-03 09:27:33 -04:00
Steve Polito e659f46da1
Conditionally print `$stdout` when invoking `run_generator` (#49448)
* Conditionally print `$stdout` when invoking `run_generator`

In an effort to improve the developer experience when debugging
generator tests, we add the ability to conditionally print `$stdout`
instead of capturing it.

This allows for calls to `binding.irb` and `puts` work as expected.

```sh
PRINT_STDOUT=true ./bin/test test/generators/actions_test.rb
```

* Update railties/CHANGELOG.md

Co-authored-by: Rafael Mendonça França <rafael@franca.dev>

* Rename environment variable

* Update generators guides.

* Update guides

---------

Co-authored-by: Rafael Mendonça França <rafael@franca.dev>
2023-10-03 07:01:16 -04: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
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 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 (3ea2857943) 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
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
Earlopain f3e0a72801
Fix formatting of two configs in configuration guide 2023-09-29 11:32:41 +02: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 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 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
Akhil G Krishnan 2e35046f61 Fix the wrong markdown hightlighting [skip ci] 2023-09-28 20:14:35 +05:30
fatkodima a7ee313d91 Enable raising when running `rubocop-md` against invalid ruby snippets 2023-09-27 23:12:48 +03:00
Koichi ITO 3e14e8dd62 Add `async_ids` to 7_1_release_notes [ci skip]
This PR adds `async_ids` introduced at https://github.com/rails/rails/pull/46503
to 7_1_release_notes.
2023-09-27 23:32:44 +09:00
Rafael Mendonça França fb6c6007d0
Development of Rails 7.2 starts now
🎉
2023-09-27 03:59:11 +00:00
Rafael Mendonça França e57a936879
Merge pull request #49397 from hatsu38/fix_typo-author_name-in_md
[skip ci] Docs: Fix typo in author name Paul Coelho -> Paulo Coelho
2023-09-26 23:23:26 -04:00
Rafael Mendonça França e5386cb402
Preparing for 7.1.0.rc1 release 2023-09-27 03:08:31 +00:00
hatsu38 c0d8528b24 [skip ci] Docs: Fix typo in author name Paul Coelho -> Paulo Coelho 2023-09-27 12:00:55 +09:00
Rafael Mendonça França 7893e0a165
Merge pull request #49194 from seanpdoyle/action-view-test-case-encoder
Introduce `ActionView::TestCase.register_parser`
2023-09-26 22:30:25 -04:00
Sean Doyle 7badc42723
Introduce `ActionView::TestCase.register_parser`
Register a callable to decode rendered content for a given MIME type

Each registered decoder will also define a `#rendered.$MIME` helper
method, where `$MIME` corresponds to the value of the `mime` argument.

=== Arguments

`mime` - Symbol the MIME Type name for the rendered content
`callable` - Callable to decode the String. Accepts the String
                    value as its only argument
`block` - Block serves as the decoder when the
                 `callable` is omitted

By default, ActionView::TestCase defines a decoder for:

* :html - returns an instance of Nokogiri::XML::Node
* :json - returns an instance of ActiveSupport::HashWithIndifferentAccess

Each pre-registered decoder also defines a corresponding helper:

* :html - defines `rendered.html`
* :json - defines `rendered.json`

=== Examples

To parse the rendered content into RSS, register a call to `RSS::Parser.parse`:

```ruby
register_decoder :rss, -> rendered { RSS::Parser.parse(rendered) }

test "renders RSS" do
  article = Article.create!(title: "Hello, world")

  render formats: :rss, partial: article

  assert_equal "Hello, world", rendered.rss.items.last.title
end
```

To parse the rendered content into a Capybara::Simple::Node,
re-register an `:html` decoder with a call to
`Capybara.string`:

```ruby
register_decoder :html, -> rendered { Capybara.string(rendered) }

test "renders HTML" do
  article = Article.create!(title: "Hello, world")

  render partial: article

  rendered.html.assert_css "h1", text: "Hello, world"
end
```
2023-09-27 02:03:23 +00:00
Rafael Mendonça França acfa045405
Revert typography change in user facing errors
This change would force a lot of existing applications and libraries
to update their tests.

We included it in the beta to collect feedback from the community and
we had some comments about how negative this change would be.

Developers that care about the typography of their error messages
can easily change it in their applications using the translation
files, so there is no need to inflict pain in the upgrade process
by changing the default in the framework.

Revert "Merge PR #45463"

This reverts commit 9f60cd8dc7, reversing
changes made to 35d574dbfd.
2023-09-26 21:45:03 +00:00
Ryuta Kamizono 1fe4538635 Fix `rewhere`'s link for API doc in the guide
This was accidentally changed at #47010.
2023-09-27 02:43:22 +09:00
Akhil G Krishnan 2022ee1be5 [skip ci] ActiveRecord notable changes added to 7.1 release note 2023-09-26 22:54:46 +05:30
Rafael Mendonça França dcc6ad5497
Merge pull request #49370 from ghiculescu/upgrade-guide-rails-test
Upgrade guide: mention `test:prepare` enhnacements
2023-09-26 12:22:16 -04:00
Rafael Mendonça França 15ccf5be96
Merge pull request #49387 from fractaledmind/ar-sqlite-7_1-release-notes
[skip ci] Add 7.1 release notes for SQLite3 adapter improvements
2023-09-26 12:03:13 -04:00
Stephen Margheim 8c5584cf07 Add 7.1 release notes for SQLite3 adapter improvements 2023-09-26 16:09:05 +02:00
zzak a564341537
Revert "Document clean chain behavior for ActiveRecord scope" 2023-09-26 20:44:22 +09:00
Ryuta Kamizono b2790b6680 Rename back unique keys to unique constraints
As we (I and @yahonda) talked about the naming in person, naming unique
constraints as unique keys is very confusing to me.
All documents and descriptions says it's unique constraints, but naming
unique keys leads to misunderstanding it's a short-hand of unique
indexes.
Just naming it unique constraints is not misleading.
2023-09-26 17:52:09 +09:00
Rafael Mendonça França ad7a3e2d80
Merge pull request #49322 from hachi8833/add_tests_for_exclusion_validation2
[Docs][Tests] Add tests for validates_exclusion_of to 7.1.0beta1
2023-09-25 16:26:58 -04:00
Akhil G Krishnan 14208d4d53 [skip ci] Missing language highligting added for bash code block 2023-09-25 21:25:33 +05:30
Xavier Noria 44d0859904 Minor edits in the upgrading guide 2023-09-25 11:45:47 +02:00
Alex 9910e37e6f Upgrade guide: mention `test:prepare` enhnacements
Fixes: https://github.com/rails/rails/issues/49363

Mentions https://github.com/rails/rails/pull/46664 in the upgrade guide.
2023-09-25 10:04:30 +10:00
Xavier Noria d99e355390 Simplify wording, avoids word wrap 2023-09-24 09:08:01 +02:00
Xavier Noria 72bd066432 Add a section about config.autoload_lib(_once) to the upgrading guide 2023-09-23 20:15:34 +02:00
Xavier Noria a7fa54d5d8 Minor reword in the upgrading guide re add_autoload_paths_to_load_path 2023-09-23 19:29:11 +02:00
Akhil G Krishnan 102eb1f0b6 ActiveRecord notable changes added to 7.1 release note
[skip ci] review changes updated
2023-09-23 20:38:45 +05:30
Xavier Noria 26d24d6dc3 Let these example match the ones in config/application.rb 2023-09-21 21:20:23 +02:00
Xavier Noria 8eed5083b7 Reword stuff related to config.autoload_lib 2023-09-21 21:14:03 +02:00
hachi8833 4fb4af7312 [Docs][Tests] Add tests for validates_exclusion_of to 7.1.0beta1 Active Model 2023-09-21 10:33:58 +09:00
Petrik 677fa58873 Improve `strict_loading` documentation [ci-skip]
Expand examples by adding singular associations.
Expand the guides with `strict_loading!`.
Also add `to_a` to code examples as loading the associations is required
to raise the errors.
2023-09-20 13:54:32 +02:00
Adrianna Chang e1d160d0ba
Remove blank line in Action Mailer Basics guide 2023-09-19 15:02:20 -04:00
Anson Hoyt 19c996f763
Add `*_deliver` callback examples [ci skip]
Examples based on the conversation in https://github.com/rails/rails/pull/47630.
2023-09-19 10:47:16 -04:00
Petrik de Heus ebcd7233ea
Merge pull request #49313 from tnir/tn-replace-firebug-in-security-guides [ci-skip]
doc: Firebug was replaced by Firefox/Chrome DevTools
2023-09-18 19:36:53 +02:00
Takuya Noguchi f8e1e20341 Firebug was replaced by Firefox/Chrome DevTools
https://getfirebug.com/index.html
https://hacks.mozilla.org/2017/10/saying-goodbye-to-firebug/
https://firefox-source-docs.mozilla.org/devtools-user/
https://developer.chrome.com/docs/devtools/

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2023-09-19 00:26:43 +09:00
Sean Doyle 8b77436dbc Add documentation for `locals:` and `local_assigns` [ci skip]
Expand the documentation for [local_assigns][] to mention potential
integrations with [Ruby 3.1's pattern matching
assignment][pattern-matching].

Expand the Action View Overview guides to describe calls to `render`
with `locals:` options, along with the existence of the `local_assigns`
method. Also outline potential integrations with Ruby 3.1's pattern
matching assignment.

[local_assigns]: https://api.rubyonrails.org/classes/ActionView/Template.html#method-i-local_assigns
[pattern-matching]: https://docs.ruby-lang.org/en/master/syntax/pattern_matching_rdoc.html
2023-09-18 08:31:03 -04:00
Hartley McGuire d21d811ffe
Merge pull request #49291 from hungmi/fix-typos-in-action-view-test-case-documentation
[ci skip] Edit anchors in Testing View Partials to match targets
2023-09-15 14:05:27 -04:00
Nick Schwaderer a50be005ae
Update 7_1_release_notes.md (#49285)
* Update 7_1_release_notes.md

For context see https://github.com/rails/rails/pull/45867

Include in release notes the deprecation of `true` and `false` values
for `config.action_dispatch.show_exceptions` in favor of `:all`,
`:rescuable` and `:none`.

* Update 7_1_release_notes.md

Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>

---------

Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>
Co-authored-by: Rafael Mendonça França <rafael@rubyonrails.org>
2023-09-15 13:52:51 -04:00
hungmi f4234474e0 Edit anchors in Testing View Partials to match targets 2023-09-16 01:45:15 +08:00
Rafael Mendonça França 3c8e3fe37f
Merge pull request #49288 from seanpdoyle/action-view-guides-shared-partials
Action View: docs use `application/` instead of `shared/`
2023-09-15 13:05:18 -04:00
Rafael Mendonça França 19930b4c63
Merge pull request #49276 from akhilgkrishnan/add-railties-notable
Added new railties notable changes in 7.1 release note [skip ci]
2023-09-15 12:12:12 -04:00
Rafael Mendonça França 93ea1d0219
Merge pull request #49289 from esasse/remove-mispell-docs
Remove misspell references [ci skip]
2023-09-15 12:11:24 -04:00
Sean Doyle 32faee0e52 Action View: docs use `application/` instead of `shared/`
Change mentions of `app/views/shared` in the guides to be
`app/views/application` instead. View partials rely on the same
[Template Inheritance][] as their template counterparts, so the guides
should encourage end-users to benefit from that inheritance.

> This makes `app/views/application/` a great place for your shared
> partials, which can then be rendered in your ERB as such:
>

```html+erb
<%# app/views/admin/products/index.html.erb %>
<%= render @products || "empty_list" %>

<%# app/views/application/_empty_list.html.erb %>
There are no items in this list <em>yet</em>.
```

To enforce that template resolution, this commit also replaces
references to `shared/` with `application/` in the Rails test suite.

[Template Inheritance]: https://guides.rubyonrails.org/layouts_and_rendering.html#template-inheritance
2023-09-15 12:06:22 -04:00
Erick Sasse 7c2e4fc5eb Remove misspell references 2023-09-15 16:02:54 +00:00
Alex Ghiculescu ccde530867 Shorten some of the guide names in the Guides index 2023-09-15 07:52:59 +10:00
Akhil G Krishnan 524f485d9e
Added new railties notable changes in 7.1 release note 2023-09-14 17:35:52 +00:00
Akhil G Krishnan 96ff4767bf
Add missing dollar sign to bash scripts 2023-09-14 16:55:46 +00:00
Eileen M. Uchitelle ff309346d3
Merge pull request #49268 from ghiculescu/cpk-guide
Add Composite Primary Keys guide to guides index
2023-09-14 11:39:14 -04:00
Alex 25524826aa Add Composite Primary Keys guide to guides index 2023-09-14 12:32:33 +10:00
Sean Doyle a92bc713ee
Update guides/source/testing.md
Co-authored-by: Adrianna Chang <adrianna.chang@shopify.com>
2023-09-13 10:18:52 -04:00
Sean Doyle a9148b45f3 Add "Testing View Partials" section to the Testing Guides
Motivation / Background
---

While the `ActionView::TestCase` class isn't marked with a `:nodoc:`
comment to indicate that it's internal to Rails, there isn't much
content in the guides that explains how to test view partials.

Libraries like
[view_component](https://github.com/ViewComponent/view_component/) have
[built-in support for
testing](https://viewcomponent.org/guide/testing.html), including
Capybara integration.

While `ActionView::TestCase` already integrates with
`rails-dom-testing`, that integration could be better documented.
Additionally, it wouldn't take much for consuming applications to mimic
the ViewComponent testing experience for their Action View Partials.

Details
---

First, link to the "Testing Rails Applications" page from the
`ActionView::TestCase` class documentation.

Next, add a "Testing View Partials" section to the guides that expands
upon the variety of tooling available to tests that inherit from
`ActionView::TestCase`. In that section, cover topics like:

* the `render` helper method
* the `rendered` helper attribute reader
* calls to `assert_select` with attribute placeholders
* the `document_root_element` helper method
* integration with Ruby's Pattern Matching
* opportunities to integrate with Capybara

Additional Information
---

Additionally, add test coverage that exercise the examples shared in the
new section, including:

* Calls to `assert_select` that utilize attribute placeholders
* Ruby 3.0's Pattern Matching
* Integration with Capybara
2023-09-13 09:44:44 -04:00
Rafael Mendonça França 699dfdb426
Preparing for 7.1.0.beta1 release 2023-09-13 00:36:01 +00:00
Jason Meller 274bc97d63
Add Bun support (#49241)
* Add Bun support to `rails new -j` generator

* Add additional generation consideration for Bun

* Use development gems to test the whole workflow

* Remove custom gems from local testing

* Revert lock

* Revert errant custom gem declaration

* Fix linting errors

* Fix remnants of bad merge

* Always use latest bun

* Update actioncable/lib/rails/generators/channel/channel_generator.rb

Co-authored-by: Cadu Ribeiro <mail@cadu.dev>

* Update guides/source/working_with_javascript_in_rails.md

Co-authored-by: Rafael Mendonça França <rafael@franca.dev>

* Only use the latest bun if nothing is specified

* Hardcode known good version

---------

Co-authored-by: Cadu Ribeiro <mail@cadu.dev>
Co-authored-by: Rafael Mendonça França <rafael@franca.dev>
2023-09-12 16:55:27 -04:00
Rafael Mendonça França 15c639fab2
Active Job, not ActiveJob 2023-09-12 01:15:37 +00:00
Rafael Mendonça França 1b97206dd3
Revert "Remove AbstractController::Translation.raise_on_missing_translations added to release note [skip ci]" (#49221) 2023-09-11 11:44:04 -04:00
Eileen M. Uchitelle 450f64d595
Merge pull request #49219 from Shopify/AR-supports-non-PK-column-named-id
Rails supports but does not recommend non-PK `id` column
2023-09-11 11:20:50 -04:00
Adrianna Chang 4cfb6d0111
[ci skip] Fix typo in association guides 2023-09-11 10:51:15 -04:00
Nikita Vasilevsky 6100664a41
Rails supports but does not recommend non-PK `id` column 2023-09-11 14:28:14 +00:00
Eileen M. Uchitelle 0bddf3513b
Merge pull request #49218 from Shopify/suggest-cpk-for-join-tables
[ci skip] Suggest using composite primary key on join tables in `:through` associations
2023-09-11 10:24:21 -04:00
Nikita Vasilevsky 5f69951cf2
Suggest using composite primary key on join tables in `:through` associations 2023-09-11 14:19:01 +00:00
Ryuta Kamizono bb4dbd14f8
Merge pull request #49213 from akhilgkrishnan/action-config-removal-release-note
Remove AbstractController::Translation.raise_on_missing_translations added to release note [skip ci]
2023-09-11 15:26:27 +09:00
Jonathan Hefner 43a9e05dc4 Describe AS::MessagePack in 7.1 release notes [ci-skip]
This covers #47770, #47964, #48103, and #48104, plus the follow-up
changes to `ActiveSupport::Cache::Store` options from #48449 and #48451.
2023-09-10 17:52:55 -05:00
Jonathan Hefner 659d378b21 Tweak summary of `generates_token_for` in CHANGELOG [ci-skip] 2023-09-10 16:45:56 -05:00
Jonathan Hefner 38e388bbb8 Tweak summary of `normalizes` in CHANGELOG [ci-skip] 2023-09-10 16:44:21 -05:00
Jonathan Hefner 843283b4dd Add negative `where` examples for `normalizes`
In #49105, `where` examples were added to the `normalizes` documentation
to demonstrate that normalizations are also applied for `where`.
However, as with the `exists?` examples, we should also demonstrate that
normalizations are only applied to keyword arguments, not positional
arguments.  We can also address the original source of the confusion by
changing the wording of "finder methods" to "query methods".

This commit also removes the tests added in #49105.  `normalizes` works
at the level of attribute types, so there is no need to test every query
method.  Testing `find_by` is sufficient.  (And, in point of fact,
`find_by` is implemented in terms of `where`.)
2023-09-10 16:40:29 -05:00
Akhil G Krishnan a564e758c9
Remove Enumerable#sum from guide 2023-09-10 05:48:41 +00:00
Akhil G Krishnan f4c868ffbf
Remove AbstractController::Translation.raise_on_missing_translations added to release note 2023-09-10 05:10:48 +00:00
Alex Ghiculescu ff6881d2b2
Remove old `raise_on_missing_translations` behaviour
ref: https://github.com/rails/rails/pull/47105#issuecomment-1400843060

Removes the old `raise_on_missing_translations` accessors, that used to live [here](fee61e3abc/actionpack/lib/abstract_controller/translation.rb (L7)) and [here](5c835bd669/actionview/lib/action_view/helpers/translation_helper.rb (L15)).

Closes https://github.com/rails/rails/pull/45361
2023-09-09 19:59:49 +00:00
Ryuta Kamizono 97737abbeb Merge pull request #49201 from akhilgkrishnan/remove-webpacker-file
Remove unused webpacker related files
2023-09-09 07:44:54 +09:00
Adrianna Chang 2b7fb8fe4f
Add guide for composite primary keys
Co-authored-by: Noah Gibbs <noah.gibbs@shopify.com>
2023-09-08 13:55:34 -04:00
Eileen M. Uchitelle 8bea21ec32
Merge pull request #49186 from Shopify/migration_guide_cpk_create
[ci skip] Add a section to the Active Record Migration Guide on creating tables with composite primary keys
2023-09-08 08:48:33 -04:00
Noah Gibbs 5ee23cb845
Add a section on creating tables with composite primary keys 2023-09-08 13:37:28 +01:00
Noah Gibbs 0501555800
Note that guide text should wrap at 80 columns 2023-09-08 13:22:28 +01:00
Akhil G Krishnan cafad7a23a
Remove unused webpacker related files 2023-09-08 11:22:09 +00:00
Adrianna Chang 44bd6e7aca
Merge pull request #49182 from adrianna-chang-shopify/ac-document-associations-cpk-models
Document associations between models with composite primary keys in guides [ci skip]
2023-09-07 14:13:55 -04:00
Adrianna Chang 006b91719d
Merge pull request #49188 from adrianna-chang-shopify/ac-document-more-finder-methods-cpk
Add additional docs to Query Interface guide about composite primary key models [ci skip]
2023-09-07 14:12:46 -04:00
Adrianna Chang a6faf080fe
Document associations between models with composite primary keys in Rails guides 2023-09-07 14:11:05 -04:00
Adrianna Chang ed58ce03ee
Add additional docs to Query Interface guide about composite primary key models 2023-09-07 14:02:44 -04:00
Akhil G Krishnan 73eb8bccdd
[skip ci] Made a consistant wording accross the notes 2023-09-07 17:14:18 +00:00
Hartley McGuire 0851a878d3
Merge pull request #49170 from higher-pixels/delete-async
Improving the setup for the Active Record Encryption Guide
2023-09-07 11:28:36 -04:00
Adrianna Chang 9dc2288d64
Merge pull request #49179 from Shopify/cpk-release-notes
[ci skip] Add composite primary key release note
2023-09-07 10:49:57 -04:00