Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce markdownlint for guides #5

Closed
wants to merge 104 commits into from
Closed

Introduce markdownlint for guides #5

wants to merge 104 commits into from

Conversation

zzak
Copy link
Owner

@zzak zzak commented Jan 31, 2023

This is a follow up to rails#47186, this time for all markdown content.

markdownlint is an excellent tool, and I've found it very useful for finding issues in the guides.

Many of the rules are common style issues I'm correcting on PRs, so it will be nice to have that automated.

We should also be able to use the same config with our editors, so that errors show up in real-time 🙏 and will update the contributing docs once this gets merged with how to debug and use mdl appropriately.

shouichi and others added 2 commits February 8, 2023 18:36
Background:

When creating active storage variants, `ActiveStorage::VariantRecord` is
inserted, then a file is uploaded. Because upload can be failed, the
file can be missing even though `ActiveStorage::VariantRecord` exists.

When a file is missing, we need to delete the corresponding
`ActiveStorage::VariantRecord` but there's no API to delete just one
variant e.g., `blob.variant(resize_to_limit: [100, 100]).destroy`.

Co-authored-by: Yuichiro NAKAGAWA <ii.hsif.drows@gmail.com>
Co-authored-by: Ryohei UEDA <ueda@anipos.co.jp>
fatkodima and others added 3 commits March 12, 2023 23:24
By default, exclude constraints in PostgreSQL are checked after each statement.
This works for most use cases, but becomes a major limitation when replacing
records with overlapping ranges by using multiple statements.

```ruby
exclusion_constraint :users, "daterange(valid_from, valid_to) WITH &&", deferrable: :immediate
```

Passing `deferrable: :immediate` checks constraint after each statement,
but allows manually deferring the check using `SET CONSTRAINTS ALL DEFERRED`
within a transaction. This will cause the excludes to be checked after the transaction.

It's also possible to change the default behavior from an immediate check
(after the statement), to a deferred check (after the transaction):

```ruby
exclusion_constraint :users, "daterange(valid_from, valid_to) WITH &&", deferrable: :deferred
```

*Hiroyuki Ishii*
… task

otherwise, if a gem appends to the constant, we can end up with an
error.
andrewn617 and others added 3 commits March 14, 2023 19:02
Multiple fixture paths can now be specified using the `#fixture_paths` accessor.
The codepaths related to destroying associations asynchronously now
consider when query constraints are present. In most cases, this means
interpreting the primary key as an array of columns, and identifying
associated records by a tuple of these columns, where previously this
would've been a single ID. In each of the callsites, we use branching.
This is done to maintain backwards compatibility and ensure the
signature of the destroy job remains stable: it has consumers outside of
Rails.
…nstraint

Adds support for deferrable exclude constraints in PostgreSQL.
@zzak zzak force-pushed the rubocop-md branch 3 times, most recently from 794bd7d to dadf46d Compare March 15, 2023 01:48
skipkayhil and others added 13 commits March 14, 2023 23:56
The version check [added][1] is for 3.3.13, but the CHANGELOG specifies
3.3.16

[1]: 7da3353
…-version

Fix rubygems version mentioned in CHANGELOG
active_model/forbidden_attributes_protection is not used since rails#10776
Currently we use both Thor and Rake for `bin/rails` commands.
We eventually want to get all the built-ins task promoted to Thor Commands.
This migrates the `restart` task to Thor.

With this change it also possible to restart outside the application
directory:

```bash
blog/bin/rails restart
```

Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
…e-keys

Destroying associations asynchronously respect query constraints
…pk values

`ActiveRecord::FinderMethods#find` now supports passing sets of
composite primary key values like:

```ruby
Cpk::Book.find([1, 1])
Cpk::Book.find([[1, 1]])
Cpk::Book.find([1, 1], [1, 2])
Cpk::Book.find([[1, 1], [1, 2]])
```

and treats values as values of the composite primary key columns but
only for models with the `primary_key` being an `Array`.
Initial implementation falls back to `primary_key.is_a?(Array)` so
it can be immediately used in place of direct `is_a?` checks.
Though implementation may be changed to rely on a pre-initialized
`@composite_primary_key` ivar in the future.
…ier-in-find

Extend `ActiveRecord::FinderMethods#find` with support for composite pk values
…trings

Revert "Quote binary strings in Arel"
nvasilevski and others added 27 commits March 24, 2023 12:45
Given a model with a composite primary key like:
`TravelRoute.primary_key = [:from, :to]`

Calling `TravelRoute.ids` would return an array of identifiers which is
represented by an array of arrays:

```ruby
TravelRoute.all.ids # => [["Ottawa", "New York"], ["London", "Paris"]]
```
`Listen.to` starts a bunch of background threads that need to perform
some work before they are able to receive events, but it doesn't block
until they are ready, which expose us to a race condition.

With `wait_for_state(:processing_events)` we can ensure that it's ready on
Linux, however on macOS, the Darwin backend has a second background thread
we can't wait on.

As a workaround we wait a bit after the fork to allow that thread to
reach it's listning state.
…ociation-from-a-non-query-constraints-model

Fix precedence of `primary_key:` in associations with `query_constraints`
…-cpk-model

Fix `ActiveRecord::Calculations#ids` for a composite primary key model
…It is deprecated, but it should still return a string until it is removed. So, if multiple fixture_paths are configured, it just returns the first path.
…of-deprecated-fixture-path-method

`TestFixtures#fixture_path` should return a single path
…-hook

Add `ActiveSupport` load hook for `ActionText::EncryptedRichText`
implement `provider_job_id` for Backburner jobs
…arset

Set charset in content type response headers (OWASP)
Bring String#truncate* docs in line with signatures
move directory existence check for code statistics task inside of the…
…e-partial

Allow Attachables to override default template when attachment is missing
Use indentation for dividing sections in USAGE files
…d-file-update-checker

Fix race condition in evented file update checker
Update recommended Node.js dev deps guide
Add a note about installing dev deps on debian linux
This is a follow up to rails#47186, this time for all markdown content.

[markdownlint](https://github.com/markdownlint/markdownlint) is an excellent tool, and I've found it very useful for finding issues in the guides.

Many of the rules are common style issues I'm correcting on PRs, so it will be nice to have that automated.

We should also be able to use the same config with our editors, so that errors show up in real-time 🙏 and will update the contributing docs once this gets merged with how to debug and use mdl appropriately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet