Commit Graph

88756 Commits

Author SHA1 Message Date
zzak
b9bdbce61b
Refactor actions to make fewer status checks 2023-08-22 12:13:05 +09:00
Rafael Mendonça França
9b6dee054d
Merge pull request #48984 from shouichi/sandbox-by-default
Add an option to start rails console in sandbox mode by default
2023-08-21 21:22:02 -04:00
Shouichi Kamiya
b8decf79d8 Add an option to start rails console in sandbox mode by default
To avoid accidental writing to the production database, I always start
rails console in sandbox mode. I only start rails console in non-sandbox
mode when I'm sure I want to write to the production database.

`sandbox_by_default` option is added to start rails console in sandbox
mode by default. With this option turned on, `--no-sandbox` must be
specified to start rails in non-sandbox mode.

Note that this option is ignored when rails environment is development
or test.
2023-08-22 09:23:52 +09:00
Hartley McGuire
c2f838e80c
Fix 6.1 change_column setting datetime precision
This is already the case for add_column and create_table, but
change_column was missed
2023-08-21 19:10:14 -04:00
Rafael Mendonça França
a4d02fb6cc
Merge pull request #48992 from p8/guides/7-1-release-notes-additions
Add strict locals and Rails.application.deprecators to 7.1 release notes
2023-08-21 16:50:21 -04:00
Petrik
a0cc3e9a07 Add strict loals and Rails.application.deprecators to 7.1 release notes
[ci-skip]
2023-08-21 22:34:51 +02:00
Rafael Mendonça França
24876e6a79
Merge PR #48950 2023-08-21 19:27:53 +00:00
Rafael Mendonça França
ae20b0da9e
Merge pull request #47505 from julianfssen/update-api-link-to-button-to-turbo
Add docs for `data-turbo-method` and `data-turbo-confirm` for `link_to`
2023-08-21 15:11:48 -04:00
Rafael Mendonça França
7797681cb2
Simplify the logic in the documentation. 2023-08-21 19:10:13 +00:00
Rafael Mendonça França
461ee94a0f
Merge pull request #44981 from tan-linx/improvement/how-to-use-remote-selenium-configuration
Add additional config to docs about how to use remote browser in test
2023-08-21 15:08:46 -04:00
Rafael Mendonça França
3642668935
Merge pull request #48941 from skipkayhil/hm-show-correct-blocked-hosts
Fix host display when X_FORWARDED_HOST authorized
2023-08-21 15:05:44 -04:00
Rafael Mendonça França
ccee593fed
Merge pull request #48930 from adrianna-chang-shopify/ac-id-value
Use `alias_attribute` to provide `id_value` alias for `id` attribute
2023-08-21 14:33:39 -04:00
Adrianna Chang
e90b11e77e
Use alias_attribute to provide #id_value alias for #id
This allows access to the raw id column value on records for which an
id column exists but is not the primary key. This is common amongst
models with composite primary keys.
2023-08-21 14:12:53 -04:00
Rafael Mendonça França
6beb3482cd
Merge pull request #48991 from andrewn617/fix-alias-attribute-on-superclass
Fix defect where aliased attribute methods on abstract classes were not being defined
2023-08-21 13:55:46 -04:00
Rafael Mendonça França
3b08b674db
Remove Brakeman from security guide
We should not be endorsing any external library in our guides.
2023-08-21 17:48:31 +00:00
Rafael Mendonça França
53a3a95d01
Merge PR #48010 2023-08-21 17:39:03 +00:00
Andrew Novoselac
211146b845 Fix defect where aliased attribute methods on abstract classes were being not defined
rails/rails@a88f47d fixed an issue where subclasses were regenerating aliased attribute methods defined on parent classes. Part of the solution was to call #generate_alias_attributes recursively on a class's superclass to generate all the alias attributes in the inheritance hierarchy. However, the implementation relies on #base_class to determine if we should call #generate_alias_attributes on the superclass. Since all models that inherit from abstract classes are base classes, this means that #generate_alias_attributes will never be called on abstract classes, meaning no method will be generated for any alias attributes defined on them.

To fix this issue, we should always call #generate_alias_attributes on the superclass unless the superclass is ActiveRecord::Base.
2023-08-21 13:32:26 -04:00
Joé Dupuis
4b3571803b Fix regression blocking creation of some strict association
PR #48606 introduced a regression preventing the creation of a chain
of models using a has_one through association when strict_loading is
activated.

The association relies on the initial stale_state being `nil`
to skip loading the target.
755c13f167/activerecord/lib/active_record/associations/association.rb (L175)

PR #48606 initializes the stale_state to `[nil]`
https://github.com/rails/rails/pull/48606/files#diff-39c3da3c5f3fbff01b0a32d3b7ec613fda6bc6225fdbe2629134d91babe37786R84-R86

This change converts the `[nil]` state back to `nil`.
2023-08-21 10:32:08 -07:00
Rafael Mendonça França
3bfda4c66c
Merge pull request #48989 from spickermann/sort-mailers-on-preview-page-alphabetically
Sort mailers on mailer preview page alphabetically
2023-08-21 13:06:18 -04:00
Rafael Mendonça França
0306f5ad40
Add more async queries support to release notes
[ci skip]
2023-08-21 16:29:14 +00:00
Rafael Mendonça França
c6dd10a9de
Create draft of 7.1 release notes 2023-08-21 16:24:25 +00:00
Rafael Mendonça França
77080d5e17
Initialize @has_query_constraints to false in the inherited hook
`has_query_constraints?` is a class method so doing it in init_internals
would not define the right variable.
2023-08-21 15:58:58 +00:00
Jean Boussier
bef4c6904e
Merge pull request #48988 from jdelStrother/redis-distr-pipeline
Add Redis::Distributed support for pipelined write_multi
2023-08-21 15:30:53 +02:00
Martin Spickermann
dd8b0e4684 Sort mailers on mailer preview page alphabetically 2023-08-21 11:11:25 +02:00
Jonathan del Strother
c47b4095cc
Add Redis::Distributed support for pipelined write_multi 2023-08-20 19:17:25 +01:00
Vipul A M
5e2d79b5cc
Wordsmitthing and replaced all NBSP's with a single space for Assets Pipeline guide (#48980)
* Wordsmitthing and replaced all NBSP's with a single space

* Remove reference of webpacker guide from asset pipeline guide
2023-08-19 21:48:06 +05:30
Guillermo Iguaran
5a21634407
Merge pull request #48956 from skipkayhil/hm-rack-lint-show-exceptions-failsafe
Add test coverage for ShowExceptions failsafe
2023-08-18 16:08:41 -07:00
Guillermo Iguaran
4ec3a986d5
Merge pull request #48959 from skipkayhil/hm-clean-filters-requires
Remove uneeded requires of core_ext/string/filters
2023-08-18 16:03:44 -07:00
Rafael Mendonça França
c82d624ea1
Fix documentation of with_routing in the class level
There is no assertions inside it.
2023-08-18 22:21:06 +00:00
Rafael Mendonça França
ce36426c98
Initialize the variable in the init_internals method
This will avoid that the conditional assignment is executed every time
has_query_constraints? is called.
2023-08-18 22:13:14 +00:00
Rafael Mendonça França
08cd280866
Use class method module instead of DSL
This will make sure documentation is generated for the module.
2023-08-18 22:11:48 +00:00
eileencodes
3b5a4a56fb
Fix uninitialized ivar 2023-08-18 13:30:51 -04:00
Eileen M. Uchitelle
72f44412a6
Merge pull request #48971 from eileencodes/add-method-for-accessing-only-query-constraints
Add method for accessing only query constraints
2023-08-18 13:24:51 -04:00
eileencodes
784ca88173
Add method for accessing only query constraints
I'm working on an enhancement to query constraints that will require me
to know when we have query constraints but not a composite key.
Currently if you have a composite key it will be included in the query
constraints list. There's not a way to differentiate between the two
which means that we're forced into setting the query constraints on the
associations for the primary key.

This change adds a `has_query_constraints?` method so we can check the
class for query constraints. The options still work as well but we can
be sure we're always picking up the query constraints when they're
present.
2023-08-18 13:21:06 -04:00
Guillermo Iguaran
fd9333458d
Merge pull request #48955 from skipkayhil/hm-fix-use-puma-detection
Fix served_url printed when using Puma & Rack 3
2023-08-17 17:26:03 -07:00
Rafael Mendonça França
244bdab8f0
Merge pull request #48958 from Mangara/Mangara-patch-1
Update job testing guidelines
2023-08-17 20:10:14 -04:00
Hartley McGuire
2d61a206f4
Fix served_url printed when using Puma & Rack 3
This `#use_puma?` check was [introduced][1] because Rails could
potentially display the wrong server URL in development if another host
or port is configured in `config/puma.rb`.

However, in Rack 3 the the name of the server class changed from
`Rack::Handler::Puma` to `Rackup::Handler::Puma`, which means that the
served_url is being logged again.

This commit fixes the check to accept either version of the class.
Additionally, puma was updated in Gemfile.lock because Puma 6.0.x prints
a deprecation warning about Rack::Handler that's fixed in 6.1.0.

[1]: 29648ff60e66c674b3cc49151df15dc100ffb4f4
2023-08-17 20:01:19 -04:00
Guillermo Iguaran
1e824aa8e0
Merge pull request #48961 from skipkayhil/hm-rack-lint-cable-health
Add Rack::Lint to ActionCable::Server health tests
2023-08-17 16:51:41 -07:00
Jonathan Hefner
261975dbef
Merge pull request #48970 from jonathanhefner/apidocs-main-page-fix-list-numbering
Fix list item numbering on API docs main page [ci-skip]
2023-08-17 16:26:54 -05:00
Jonathan Hefner
92dcc9a09f Fix list item numbering on API docs main page [ci-skip]
Follow-up to #47178.

RDoc's Markdown parser requires multi-line list items to use a hanging
indent of at least four spaces.  Otherwise, trailing lines will be
rendered as an independent paragraph, and the next list item will start
a new list.
2023-08-17 16:22:16 -05:00
Eileen M. Uchitelle
ac5f9dec53
Merge pull request #48947 from eileencodes/use-IN-sql-over-OR-with-query-constraints
Use IN sql instead of OR sql for query constraints
2023-08-17 15:34:31 -04:00
eileencodes
0bbf4e86cb
Use IN sql intead of OR sql for query constraints
We originally implemented this project to use OR queries instead of IN
because it seemed like there was no way to do that without a row
constructor. While working on implementing this feature in our vitess
gem I noticed that we can actually get the queries we wanted, and the
new code is more performant than generating an OR.

SQL Before:

```sql
SELECT "sharded_comments".*
FROM "sharded_comments"
WHERE ("sharded_comments"."blog_id" = 969142904
AND ("sharded_comments"."blog_post_id" = 357271355
OR "sharded_comments"."blog_post_id" = 756811794)
OR "sharded_comments"."blog_id" = 308674288
AND "sharded_comments"."blog_post_id" = 1055755181)
```

SQL After:

```sql
SELECT "sharded_comments".*
FROM "sharded_comments"
WHERE "sharded_comments"."blog_id"
IN (969142904, 308674288)
AND "sharded_comments"."blog_post_id"
IN (357271355, 756811794, 1055755181)
```

Using one of the tests that utilizes this code path, I benchmarked the
queries. The new implementation is faster:

Before:

```
Warming up --------------------------------------
             queries   147.000  i/100ms
Calculating -------------------------------------
             queries      1.486k (± 3.2%) i/s -      7.497k in   5.050742s
```

After:

```
Warming up --------------------------------------
             queries   179.000  i/100ms
Calculating -------------------------------------
             queries      1.747k (± 4.5%) i/s -      8.771k in   5.031424s
```

We can probably improve this more but I think this query is more in line
with what we want and expect while also being more performant (without
having to build a new row constructor in arel).
2023-08-17 15:04:32 -04:00
Eileen M. Uchitelle
b56f938b5f
Merge pull request #48964 from sinsoku/fix-method-name
Fix method name to `check_all_pending!`
2023-08-17 10:04:41 -04:00
Eileen M. Uchitelle
8abfcd752a
Merge pull request #48913 from ipc103/fix-parent-deprecation-warning
Allow parent to define alias method override
2023-08-17 09:46:26 -04:00
Jean Boussier
8eb051a6e6
Merge pull request #48967 from jdelStrother/distributed-redis-tests
Add test coverage for RedisCacheStore with Redis::Distributed / ConnectionPool
2023-08-17 14:05:12 +02:00
Jonathan del Strother
1b3d884bb3
Add test coverage for RedisCacheStore with Redis::Distributed / ConnectionPool
This 'forward-ports' some tests added against 7-0-stable here: #48952

Also fixes a bug in supports_expire_nx? when using distributed-redis.
2023-08-17 12:34:28 +01:00
Jean Boussier
7f8cdb1dc3
Merge pull request #48966 from byroot/fix-codespell-yarn
Do not codespell yarn.lock
2023-08-17 12:49:53 +02:00
Jean Boussier
ca781c84cd Do not codespell yarn.lock 2023-08-17 12:48:20 +02:00
Takumi Shotoku
0e41e2cd8e
Fix method name to check_all_pending!
The method added in 03379d1f59 is `check_all_pending!`, not
`check_pending_migrations!`.
2023-08-17 16:51:39 +09:00
Yasuo Honda
2fa54931cf
Merge pull request #48949 from skipkayhil/hm-fix-suggesting-missing-gems
Do not suggest adding non-existent gems to Gemfile
2023-08-17 12:13:52 +09:00