Fix: https://github.com/rails/rails/issues/51386
This significantly reduce the depth of the tree for large `OR`
conditions. I was initially a bit on the fence about that fix,
but given that `And` is already implemented this way, I see no
reasons not to do the same.
Amusingly, the reported repro script now makes SQLite fail:
```ruby
SQLite3::SQLException: Expression tree is too large (maximum depth 1000)
```
If running in an interactive console, the user will be given the option to correct the error and re-run the tests.
Co-authored-by: Gannon McGibbon <gannon.mcgibbon@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>
Ref: https://github.com/rails/rails/pull/26103
Ref: https://github.com/rails/rails/pull/51426
A fairly common mistake with Rails is to enqueue a job from inside a
transaction, and 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 iin 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.
But more generally, being able to defer work to after the current transaction
has been a missing feature of Active Record. Right now the only way to do it
is from a model callback, and this forces moving things in Active Record
models that sometimes are better done elsewhere. Even as a self-proclaimed
"service object skeptic", I often wanted this capability over the last decade,
and I'm sure it got asked or desired by many more people.
Also there's some 3rd party gems adding this capability using monkey patches.
It's not a reason to upstream the capability, but it's a proof that there is
demand for it.
Implementation wise, this proof of concept shows that it's not really hard to
implement, even with nested multi-db transactions support.
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
Commit 6795a24c61b038c64abff834df86d2d2459b2b23 made `proxy_assocation`
non-public API by marking it `:nodoc`.
This change remove references to `proxy_association` from the guides.