This can cause a lot of issues that are hard to detect.
It is better to make this opt-in for people that want to use it.
In Rails 8 we can revisit if we want to enable this config by default.
There is no reason to expose all those details to users and this
has the benefit that now are can ensure that the YJIT is enabled
after all initialization is done.
For Rails 7.2 we will make devcontainer and opt-in feature for new applications. When creating a new app, you can generate a devcontainer by passing the --devcontainer flag.
mysql2 gem, as of mysql2 0.5.6, can now be compiled
with openssl@3 without any option on macOS. Also as
openssl@1.1 got EOL'd on 2023-09-11, we should not
recommend to use it.
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
This commit adds a deprecation warning for the `query_constraints:`
association option. This option will change behavior in the future versions
of Rails and applications are encouraged to switch to `foreign_key:` to preserve the
current behavior.
This is too much complexity for something low value. Let's just always
warn when a test doesn't have any assertions.
If people want to raise an error or ignore them, they can do so by
overriding `Warning.warn`.
When — is used in a subtitle, the anchor links use -%E2%80%94-
instead of —. This prevents the browser jumping to the anchor link.
Replacing — with : fixes the problem.
Co-authored-by: James Bunch <fallwith@gmail.com>
As is the case with the `rake preview_docs` task.
```
Error reading assets/stylesrc/style.scss: Cannot open file.
Error reading assets/stylesrc/highlight.scss: Cannot open file.
Error reading assets/stylesrc/print.scss: Cannot open file.
```
Rails 4.2 onwards replaced filter with action callback. However,
the term has remained in the rails guides and this PR fixes this.
Term used is "action callbacks" as this was used in the changelog:
> Deprecate all *_filter callbacks in favor of *_action callbacks.
[Original Change](489a8f2a44)
Types of change:
- Filter(s) => Action callback(s)
- Generalized the word "Action callbacks" as it is longer.
- actions => "controller actions" to make "controller actions"
more distinct from "action callbacks".
After reviewing the Action View Overview guide, a discussion started
around the builder gem that was detailed in the guide. We decided to
move it to the rails/ umbrella so we can help maintain it as needed,
since the framework uses/documents it, keeping it similar to jbuilder.
https://github.com/rails/rails/pull/51435#discussion_r1556390070
This updates print CSS to be more inline with the overall style. The sidebar is inlined (same as mobile), and content is 100%. Previous code in the launch from boilerplate has been struck or integrated better.
* Links show in text after the original link text
* Border line around code and copy button are removed
* Print is now generated from SCSS to CSS via the generator that builds the other CSS files
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
This commit addresses the CI failure at https://buildkite.com/rails/rails-nightly/builds/424#018eee82-61fb-41ae-bc2b-21bc60dde483/1240
Since https://rubygems.org/gems/sqlite3/versions/2.0.0 has been released, while Rails application just allows sqlite3 gem version 1.*
some of bug_report_templates does not have the same version requirement. these bug report templates attemp to install the latest sqlite3 version 2.0.0, it raises the LoadError.
This version requiremnt is taken from that for Rails application.
0601929486/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb (L14)0601929486/railties/lib/rails/generators/database.rb (L19)
Gemfile for Rails framework has different version requirement, this commit uses the version requirement for Rails application. Both of them eventually install the sqlite3 1.*.
0601929486/Gemfile (L157)
- Steps to reproduce
```
git clone https://github.com/rails/rails
cd guides/bug_report_templates
ruby action_mailbox.rb
ruby active_record.rb
ruby active_record_migrations.rb
ruby active_storage.rb
```
- Error without this commit
```
$ ruby action_mailbox.rb
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
-- create_table(:active_storage_blobs, {:id=>:primary_key})
/home/yahonda/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/bundler/rubygems_integration.rb:237:in `block (2 levels) in replace_gem': Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? can't activate sqlite3 (~> 1.4), already activated sqlite3-2.0.0-x86_64-linux-gnu. Make sure all dependencies are added to Gemfile. (LoadError)
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:14:in `<top (required)>'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/abstract/connection_handler.rb:333:in `resolve_pool_config'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/abstract/connection_handler.rb:134:in `establish_connection'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_handling.rb:53:in `establish_connection'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/railtie.rb:304:in `block (2 levels) in <class:Railtie>'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `class_eval'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `block in execute_hook'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_control'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:78:in `block in run_load_hooks'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `each'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `run_load_hooks'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/base.rb:338:in `<module:ActiveRecord>'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/base.rb:15:in `<top (required)>'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/tasks/database_tasks.rb:506:in `migration_class'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/tasks/database_tasks.rb:510:in `migration_connection'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1032:in `connection'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1037:in `block in method_missing'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1017:in `block in say_with_time'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/benchmark.rb:298:in `measure'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1017:in `say_with_time'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1036:in `method_missing'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:566:in `create_table'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration/compatibility.rb:110:in `create_table'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/db/migrate/20170806125915_create_active_storage_tables.rb:6:in `change'
from action_mailbox.rb:51:in `block in <main>'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:55:in `instance_eval'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:55:in `define'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:50:in `define'
from action_mailbox.rb:50:in `<main>'
/home/yahonda/.rbenv/versions/3.3.0/lib/ruby/site_ruby/3.3.0/bundler/rubygems_integration.rb:237:in `block (2 levels) in replace_gem': can't activate sqlite3 (~> 1.4), already activated sqlite3-2.0.0-x86_64-linux-gnu. Make sure all dependencies are added to Gemfile. (Gem::LoadError)
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:14:in `<top (required)>'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/abstract/connection_handler.rb:333:in `resolve_pool_config'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/abstract/connection_handler.rb:134:in `establish_connection'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/connection_handling.rb:53:in `establish_connection'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/railtie.rb:304:in `block (2 levels) in <class:Railtie>'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `class_eval'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:97:in `block in execute_hook'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_control'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:78:in `block in run_load_hooks'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `each'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/lazy_load_hooks.rb:77:in `run_load_hooks'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/base.rb:338:in `<module:ActiveRecord>'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/base.rb:15:in `<top (required)>'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/tasks/database_tasks.rb:506:in `migration_class'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/tasks/database_tasks.rb:510:in `migration_connection'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1032:in `connection'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1037:in `block in method_missing'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1017:in `block in say_with_time'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/3.3.0/benchmark.rb:298:in `measure'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1017:in `say_with_time'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:1036:in `method_missing'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration.rb:566:in `create_table'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/migration/compatibility.rb:110:in `create_table'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/db/migrate/20170806125915_create_active_storage_tables.rb:6:in `change'
from action_mailbox.rb:51:in `block in <main>'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:55:in `instance_eval'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:55:in `define'
from /home/yahonda/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-7.1.3.2/lib/active_record/schema.rb:50:in `define'
from action_mailbox.rb:50:in `<main>'
$
```
Review and improve Action View Overview guide [ci-skip]
* Add more code examples and update existing examples.
* Consolidate all topics related to partials in this guide.
* Restructure sections for better flow and readability.
* Reword the introduction and clarify how Action View fits in.
Note: This guide has content that's intertwined with the Layouts and Rendering guide,
with some duplicate content and overlapping concepts. A follow-on PR will focus on
the other guide and then we will do a pass over both guides together.
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Some code examples use commented out paths for the path where the code
should be written to. These paths can be ignored in the clipboard when
using the "copy" button.
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Review and improve the Action View Helpers guide.
- Reorganize sections, in most cases moving most commonly used helpers up, grouping some of the formatting ones together
- Expand with more examples and a few new methods
- Link back to the API of each helper whenever possible
- Remove WIP
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
A fairly common mistake with Rails is to enqueue a job from inside a
transaction, with a record as argumemnt, which then lead to a RecordNotFound
error when picked up by the queue.
This is even one of the arguments advanced for job runners backed by the
database such as `solid_queue`, `delayed_job` or `good_job`.
But relying on this is undesirable in my opinion as it makes the Active Job
abstraction leaky, and if in the future you need to migrate to another backend
or even just move the queue to a separate database, you may experience a lot of
race conditions of the sort.
To resolve this problem globally, we can make Active Job optionally transaction
aware, and automatically defer job queueing to `after_commit`.
Co-Authored-By: Cristian Bica <cristian.bica@gmail.com>
They're overriding the SCSS generated files since the other assets are
copied after SCSS gets generated. Since they're generated every time
with the guides anyway, they are not meant to be saved raw. (for now, at
least)
Closes#51454
[ci skip]
To much contrast in dark mode can cause halation and makes
text hard to read.
The Accessible Perceptual Contrast Algorithm (APCA)[1] has
preliminary guidelines ([2]) for maximum contrast in dark mode.
The changes introduced in this PR ensure that the contrast for
text content does not exceed Lc 90 and does not exceed Lc 75 for
large text.
The background color for inline code elements was also darkened
so that there is less contrast with the surrounding text.
1. https://github.com/Myndex
2. https://github.com/Myndex/SAPC-APCA/discussions/106
* Guides feedback fixes
@claudioduarte in https://github.com/rails/rails/discussions/51415
- [x] Make alt, shorter SVG line for mobile, add responsive style
- [x] Add side padding on footer (goes to edge on mobile, does not align on desktop)
- [x] Shrink overall height of subCol so it doesn’t overlap footer
@ivanjuric in https://github.com/rails/rails/discussions/51398
- [x] Flip inverted dark modes on “more Ruby on Rails” nav bar
DHH/Core:
- [x] Darker dark mode (Github style)
- [x] Double box on WIP call out (index.html. editable?)
- [x] NavBar bottom issue clipping on some guides (pad the content?)
- [x] Rounded corners/better appearance on select form elements in header
- [x] Black border on bottom of interstitials
* Additional UI cleanup
- [x] tightening up white space, adding Rails brand HR after intro
- [x] base fontsize to 16px from 18px;
- [x] fixing some darker dark mode issues in the last commit
* Lightening syntax highlight colors