Commit Graph

86989 Commits

Author SHA1 Message Date
zzak
c3f2b545f8
Introduce markdownlint for guides
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.
2023-03-27 12:14:18 +09:00
zzak
99096b88ae
Merge pull request #47778 from zzak/dev-deps-debian
Add a note about installing dev deps on debian linux
2023-03-27 11:36:07 +09:00
zzak
766c26d270
Add a note about installing dev deps on debian linux 2023-03-27 11:17:32 +09:00
zzak
00c0f5ee28
Merge pull request #47776 from zzak/dev-deps-node-guide
Update recommended Node.js dev deps guide
2023-03-27 10:39:58 +09:00
zzak
35180ee24a
Update recommended Node.js dev deps guide 2023-03-27 10:33:23 +09:00
zzak
3d9edd4ced
Merge pull request #47774 from zzak/fix-race-condition-in-evented-file-update-checker
Fix race condition in evented file update checker
2023-03-27 09:49:28 +09:00
zzak
754442a0cb
Use original start instead of restart here 2023-03-27 07:59:06 +09:00
Jonathan Hefner
2d43f513af Fix config.after_routes_loaded heading level [ci-skip]
Follow-up to #46539.
2023-03-26 16:44:56 -05:00
Rafael Mendonça França
89bd41201a
Merge pull request #47738 from p8/railties/thor-usage-titles
Use indentation for dividing sections in USAGE files
2023-03-25 13:05:54 -04:00
Rafael Mendonça França
febd9ab4f6
Merge PR #47150 2023-03-25 16:55:06 +00:00
Rafael Mendonça França
30683cbf85
Copy-edit CHANGELOG 2023-03-25 16:50:19 +00:00
Rafael Mendonça França
6aaa9db647
Merge pull request #46101 from swanson/swanson/missing-attachable-partial
Allow Attachables to override default template when attachment is missing
2023-03-25 12:49:54 -04:00
Rafael Mendonça França
0de99e92fd
Merge pull request #47313 from gregmolnar/stats
move directory existence check for code statistics task inside of the…
2023-03-25 12:21:46 -04:00
Rafael Mendonça França
c0a2292b0f
Merge pull request #47768 from eval/truncate-docs
Bring String#truncate* docs in line with signatures
2023-03-25 12:16:59 -04:00
Rafael Mendonça França
06a8427ec6
Merge pull request #47186 from zzak/rubocop-md
Rubocop markdown snippets
2023-03-25 11:27:47 -04:00
Rafael Mendonça França
acd8fd142d
Merge pull request #47758 from sled/security/set-content-type-charset
Set charset in content type response headers (OWASP)
2023-03-25 11:24:43 -04:00
Rafael Mendonça França
05104e82b8
Merge pull request #47732 from cmatheson/backburner-provider-job-id
implement `provider_job_id` for Backburner jobs
2023-03-25 11:21:40 -04:00
Rafael Mendonça França
166ef00399
Merge pull request #47737 from waymondo/encrypted-rich-text-load-hook
Add `ActiveSupport` load hook for `ActionText::EncryptedRichText`
2023-03-25 11:07:12 -04:00
Gert Goet
23674c5853 Bring truncate* docs in line with signatures 2023-03-25 15:49:07 +01:00
zzak
9f49959fee
Merge pull request #47766 from zzak/fix-actionpack-changelog-lint
Fix actionpack CHANGELOG lint error
2023-03-25 08:51:23 +09:00
zzak
57b01b4633
Fix actionpack CHANGELOG lint error 2023-03-25 08:32:26 +09:00
Rafael Mendonça França
338fcc37ae
Merge pull request #47764 from andrewn617/dont-change-behaviour-of-deprecated-fixture-path-method
`TestFixtures#fixture_path` should return a single path
2023-03-24 16:18:05 -04:00
Andrew Novoselac
a35a2d0d15 Fix an issue where TestFixtures#fixture_path was returning an array. 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. 2023-03-24 15:42:24 -04:00
Eileen M. Uchitelle
995768e791
Merge pull request #47762 from Shopify/ar-calculations-ids-for-a-cpk-model
Fix `ActiveRecord::Calculations#ids` for a composite primary key model
2023-03-24 09:31:16 -04:00
Eileen M. Uchitelle
643b5a6c87
Merge pull request #47742 from Shopify/fix-query-constraints-association-from-a-non-query-constraints-model
Fix precedence of `primary_key:` in associations with `query_constraints`
2023-03-24 09:29:28 -04:00
Jean Boussier
c650ef4230 Improve reliability of EventedFileUpdateCheckerTest fork test
`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.
2023-03-24 14:24:07 +01:00
Nikita Vasilevsky
1217127703 Fix ActiveRecord::Calculations#ids for a composite primary key model
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"]]
```
2023-03-24 12:45:54 +00:00
zzak
824ef94092
Merge pull request #47760 from zzak/fix-health-controller-doc
Fix where HealthController doc gets parsed
2023-03-24 18:37:08 +09:00
zzak
2ab459a40c
Fix where HealthController doc gets parsed 2023-03-24 18:34:41 +09:00
Simon Schmid
a9d191997b set charset in content type response headers 2023-03-24 10:17:04 +01:00
zzak
af10abdc92
Merge pull request #47757 from zzak/api-doc-guide-code-samples
Document SQL and IRB comment styles
2023-03-24 18:06:56 +09:00
zzak
0dde0b56e7
Document SQL and IRB comment styles 2023-03-24 17:59:42 +09:00
Jean Boussier
ca195a8917
Merge pull request #47748 from Shopify/fix-race-condition-in-evented-file-update-checker
Fix a race condition in EventedFileUpdateCheckerTest
2023-03-24 09:57:31 +01:00
Cameron Matheson
0cb0880b1a implement provider_job_id for Backburner jobs 2023-03-23 19:19:34 -06:00
Nikita Vasilevsky
f29ff0f0a0 Fix precedence of primary_key: in associations with query_constraints 2023-03-23 23:01:06 +00:00
Guillermo Iguaran
097f703d59
Merge pull request #47749 from matteeyah/main
Extract sample rate in audio analyzer
2023-03-23 12:17:10 -07:00
Matija Čupić
c0465cf6aa
Extract sample rate in audio analyzer 2023-03-23 19:50:32 +01:00
Eileen M. Uchitelle
1aac4854f9
Merge pull request #47741 from Shopify/pm/cpk-rollback
Support composite primary keys during transaction rollback
2023-03-23 10:16:11 -04:00
Jean Boussier
dd722263ff Fix a race condition in EventedFileUpdateCheckerTest
Fix: https://github.com/rails/rails/pull/47746

We need to wait for the listener threads to exit.
2023-03-23 13:52:02 +01:00
Paarth Madan
996d5023f0 Support composite primary keys during transaction rollback 2023-03-22 19:16:05 -04:00
Eileen M. Uchitelle
2cef3ac45b
Merge pull request #47729 from Shopify/pm/cpk-where-syntax
Introduce query-by-tuple syntax
2023-03-22 17:08:42 -04:00
Petrik
977bc53932 Use indentation for dividing sections in USAGE files
Thor, the generator USAGE files and some command USAGE files use
identation to divide the USAGE files into separate sections.
Indentation is also used to describe the options that can be passed
to the commands.

For consistency we should use the same formatting for all commands.
As Thor and most USAGE files already use identation it's a smaller
change to use identation for all commands.

For the examples extra identation is used. This makes them stand out
more allows removing the backticks which make it easier to copy the code
examples.

__Before (example for runner)__

```console
bin/rails runner --help
Commands:
  bin/rails runner [<'Some.ruby(code)'> | <filename.rb> | -]  # Run Ruby code in the context of your application
  bin/rails runner:help [COMMAND]                             # Describe available commands or one specific command

Options:
  -e, [--environment=ENVIRONMENT]  # The environment to run `runner` in (e.g. test / development / production).

Examples:

Run `puts Rails.env` after loading the app:

  bin/rails runner 'puts Rails.env'

Run the Ruby file located at `path/to/filename.rb` after loading the app:

  bin/rails runner path/to/filename.rb

Run the Ruby script read from stdin after loading the app:

  bin/rails runner -

You can also use the runner command as a shebang line for your executables:

  #!/usr/bin/env /path/to/weblog/bin/rails runner

  Product.all.each { |p| p.price *= 2 ; p.save! }
```

__After__

```console
bin/rails runner --help
Usage:
  bin/rails runner [<'Some.ruby(code)'> | <filename.rb> | -]

Options:
  -e, [--environment=ENVIRONMENT]  # The environment to run `runner` in (e.g. test / development / production).

Run Ruby code in the context of your application

Description:
    The Rails `runner` allows running Ruby code in the context of your application.

Examples:
    Run `puts Rails.env` after loading the app:

        bin/rails runner 'puts Rails.env'

    Run the Ruby file located at `path/to/filename.rb` after loading the app:

        bin/rails runner path/to/filename.rb

    Run the Ruby script read from stdin after loading the app:

        bin/rails runner -

    You can also use the runner command as a shebang line for your executables:

        #!/usr/bin/env /path/to/weblog/bin/rails runner
        Product.all.each { |p| p.price *= 2 ; p.save! }
```
2023-03-22 21:56:44 +01:00
Vipul A M
047a76e37f
Merge pull request #47702 from shouichi/class-cache-nodoc
Add nodoc to ActiveRecord::FixtureSet::ClassCache [skip ci]
2023-03-23 01:54:01 +05:30
Paarth Madan
350b397917 Delete Cpk::Book in non-transactional test
Having this record persisted across test runs was leading to flakey behaviour in tests that were creating Cpk::Book with the same primary key.
2023-03-22 16:16:41 -04:00
justin talbott
beb43e0182
Add ActiveSupport load hook for ActionText::EncryptedRichText
Both `ActionText::Record` and `ActionText::RichText` have dedicated `ActiveSupport` load hooks. This adds an
additional hook for `ActionText::EncryptedRichText`, so that external libraries have a similarly simple way
to run code after the subclass is loaded.
2023-03-22 16:00:08 -04:00
Paarth Madan
77b9cddbbe Use tuple query syntax to avoid branching 2023-03-22 13:56:48 -04:00
Paarth Madan
e39e013cf7 Specify where clauses by mapping columns to tuples
With the introduction of composite primary keys, a common usecase is querying for records with tuples representing the composite key. This change introduces new syntax to the where clause that allows specifying an array of columns mapped to a list of corresponding tuples. It converts this to an OR-joined list of separate queries, similar to previous implementations that rely on grouping queries.
2023-03-22 13:56:47 -04:00
Jean Boussier
e55ccf0f10 Mark RaiseWarnings as :nodoc:
I didn't expect RDoc to document this code.
2023-03-22 18:38:23 +01:00
Eileen M. Uchitelle
355fd59290
Merge pull request #47731 from Shopify/fix-CPK-models-equality
Fix `#hash` and `#==` for composite pk models
2023-03-22 10:28:45 -04:00
Nikita Vasilevsky
7b1a617c21 Fix #hash and #== for composite pk models
Given a model with a composite primary key, for example:
`TravelRoute.primary_key = [:from, :to]`

and two objects of the given model, objects `a` and `b`, should be
equal to each other and have the same `hash` value if they have the same
values for the composite primary key, like:

```ruby
a = TravelRoute.new(from: "NYC", to: "LAX")
b = TravelRoute.new(from: "NYC", to: "LAX")
a == b # => true

a.hash == b.hash # => true
```

At the same time, two objects of the given model should not be equal to
each other and should have different `hash` values if they have
different primary key values or no primary key being set, like:

```ruby
a = TravelRoute.new(from: "NYC", to: "LAX")
b = TravelRoute.new(from: "NYC", to: "SFO")
a == b # => false
a.hash == b.hash # => false

TravelRoute.new == TravelRoute.new # => false
TravelRoute.new.hash == TravelRoute.new.hash # => false
```
2023-03-22 13:46:20 +00:00