Commit Graph

81686 Commits

Author SHA1 Message Date
Drew
28a9b65f66 Pluralize the heading on the index page generated with scaffold 2021-09-17 19:14:00 -04:00
Rafael Mendonça França
4db42073cd
Move the parameter wrapper code to the ActionController::Railtie class 2021-09-17 17:11:56 -04:00
Justin Coyne
31780364b7
Add explicit rendering to DiskController#update
This avoids unhelpful messages in the logs:
```
No template found for ActiveStorage::DiskController#update, rendering head :no_content
```
2021-09-17 13:32:28 -05:00
Rafael França
1b0c914133
Merge pull request #42517 from nvasilevski/nilable-default-scope-with-all-queries
Fix update & destroy queries when default_scope is nillable with all_…
2021-09-17 13:13:30 -04:00
David Heinemeier Hansson
5d9ee65201 Suggest Kredis + bcrypt as long as we're not minimal 2021-09-17 13:57:02 +02:00
Alex Ghiculescu
5acc32ac54
Generate less initializers in new/upgraded Rails apps (part 2) (#43237) 2021-09-17 09:06:17 +02:00
Alfred
a2f9a63a82
Reorder getting_started 8.3 to reduce confusion
Recently started learning Rails through The Odin Project, and section 8.3 of the getting started guide is told to be avoided in the curriculum due to its confusing wording.
I moved the migration generation to the beginning of the section and changed the words 'you might add' to 'you would add'.
It might seem inconsequential but it hung myself and others at the TOP.
If there is a problem with my correction that I can fix, I will gladly do so.
2021-09-16 14:30:39 -05:00
Alexey Vasiliev
6b7ff4f933
Support svg unpaired tags in tag helper 2021-09-16 21:50:54 +03:00
Nikita Vasilevsky
43d83b4423
Fix update & destroy queries when default_scope is nillable with all_queries: true 2021-09-16 14:12:11 -04:00
Ryuta Kamizono
e21c38ed7f
Merge pull request #43229 from choznerol/patch-1
Add mandatory 'stored' option to generated column example
2021-09-17 00:47:26 +09:00
Lawrence Chou
447f55cc83
Add mandatory 'stored' option to generated column example
The current implementation (#41856) required `stored: true` to be passed when using `t.virtual()`
https://github.com/rails/rails/pull/41856/files#diff-5b1b920fc3bebbb1d4c144b302603e5003a1d9e5a493e3234bf764b9e26fbe30R68-R75
2021-09-16 23:22:26 +08:00
Benedikt Deicke
25aa5c4beb
Adds support for deferrable foreign key constraints in PostgreSQL
By default, foreign key constraints in PostgreSQL are checked after each statement. This works for most use cases, but becomes a major limitation when creating related records before the parent record is inserted into the database.

One example of this is looking up / creating a person via one or more unique alias.

```ruby
Person.transaction do
  alias = Alias
    .create_with(user_id: SecureRandom.uuid)
    .create_or_find_by(name: "DHH")

  person = Person
    .create_with(name: "David Heinemeier Hansson")
    .create_or_find_by(id: alias.user_id)
end
```

Using the default behavior, the transaction would fail when executing the first `INSERT` statement.

This pull request adds support for deferrable foreign key constraints by adding a new option to the `add_foreign_key` statement in migrations:

```ruby
add_foreign_key :aliases, :person, deferrable: true
```

The `deferrable: true` leaves the default behavior, but allows manually deferring the checks using `SET CONSTRAINTS ALL DEFERRED` within a transaction. This will cause the foreign keys to be checked after the transaction.

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

```ruby
add_foreign_key :aliases, :person, deferrable: :deferred
```
2021-09-16 16:40:10 +02:00
Matthew Draper
e1a09e6e80 Merge pull request #41856 from MSNexploder/virtual-columns
Add support for generated columns in PostgreSQL (Redux)
2021-09-16 23:34:33 +09:30
Ryuta Kamizono
4bbdad500c
Merge pull request #43225 from p8/railties/fix-initializers-changelog
Fix railties/CHANGELOG.md for cookie_serializer
2021-09-16 17:13:10 +09:00
Petrik
b59620c155 Fix railties/CHANGELOG.md for cookie_serializer
The framework defaults file sets the serializer to `:hybrid` instead of
`:marshal`, but we can just remove the actual setting and referer to the
defaults file instead. [ci-skip]
2021-09-16 09:48:09 +02:00
Thomas Hutterer
524c4cad07 Return just the address if name is blank
Otherwise the returned string would look like " <foo@example.com>".
2021-09-16 09:24:27 +02:00
Rafael Mendonça França
ceb4b94baa
Restore behavior added in ff66477182c7da49af2735e93886bebeac1eb162 2021-09-15 19:02:04 -04:00
Rafael Mendonça França
4ace047c91
Add back Rack::Runtime to the default middleware stack.
We were planning to remove this middleware because we thought it could
make easier to attacker to do a Time Attack. However, while
Rack::Runtime can indeed be used to know how long a request took, and
compare with other requests, it doesn't provide any information that
can't be found in the total time of the request as well.

Instead of removing the middleware, we decided to keep it, and direct
users to instead of removing it, use its information to uncover actions
that are vulnerable to Time Attack.

This reverts commit 127dd06df66552dd272eea7832f8bb205cf6fd01, reversing
changes made to 4354e3ae492e95934a6da4101556a05d20b9f897.
2021-09-15 18:37:34 -04:00
Rafael Mendonça França
d177551c30
Preparing for 7.0.0.alpha2 release 2021-09-15 18:22:51 -04:00
Rafael Mendonça França
325d34eb58
Don't use exact version in the actiontext npm dependencies
We should be able to use alpha2 or newer.
2021-09-15 18:08:12 -04:00
Rafael Mendonça França
6ab1feea79
Fix actiontext npm package dependency 2021-09-15 18:05:36 -04:00
Rafael Mendonça França
9b7be48212
Preparing for 7.0.0.alpha1 release 2021-09-15 17:55:08 -04:00
mpestov
22e6cb2576 Check basic auth credentials contains a colon 2021-09-16 00:29:34 +03:00
Rafael Mendonça França
ba57ad5245
Merge PR #42538 2021-09-15 17:19:14 -04:00
Rafael Mendonça França
fd41ea1f2d
Merge branch 'main' into less-initializers 2021-09-15 17:18:49 -04:00
Rafael Mendonça França
6d24f60441
Use :hybrid by default in the Rails 7 new defaults 2021-09-15 17:15:03 -04:00
Rafael França
4a5d8fc3c6
Merge pull request #42470 from nfedyashev/add-missing-ids-to-mailer-email-template
Add missing DOM ids to rails/mailers/email.html template
2021-09-15 13:45:34 -04:00
Rafael França
74c93fc353
Merge pull request #43099 from intrip/fix-guides-load-path-click
Fix `$LOAD_PATH` link in Autoloading Guides
2021-09-15 13:44:54 -04:00
Rafael França
ee2a3f2c7b
Merge pull request #43223 from p8/active-model-api
Introduce ActiveModel::API
2021-09-15 12:53:48 -04:00
Rafael França
1d9d538316
Merge pull request #43218 from luizkowalski/fix/documentation
Update guide to use the appropriate `concurrent-ruby` class
2021-09-15 12:36:14 -04:00
Petrik
c477d95604 Introduce ActiveModel::API
Currently `ActiveModel::Model` is defined as the minimum API to talk
with Action Pack and Action View.
Its name suggests it can be included to create Active Record type
models, but for creating models it's probably too minimal. For example
it's very common to include ActiveModel::Attributes as well.

By moving `ActiveModel::Model`'s implementation to a new
`ActiveModel::API` we keep a definition of the minimum API to talk with
Action Pack and Action View.

For `ActiveModel::Model` we only need to include `ActiveModel::API`.
This will allow adding more funcationality to `ActiveModel::Model` while
keeping backwards compatibility.

Co-authored-by: Nathaniel Watts <1141717+thewatts@users.noreply.github.com>
2021-09-15 18:24:47 +02:00
Guillermo Iguaran
f832fa58d3
Merge pull request #43204 from westonganger/remove_scope_overwrite_warning
Remove warning when overwriting existing scopes
2021-09-15 09:03:26 -07:00
luizkowalski
868a63c695 Update guide and actioncable tests to use appropriate concurrent-ruby class 2021-09-15 17:50:49 +02:00
Guillermo Iguaran
f4da3e6307
Merge branch 'main' into remove_scope_overwrite_warning 2021-09-14 19:57:23 -07:00
Aaron Patterson
0b5c7210af
Merge pull request #42993 from sambostock/use-precision-in-updated-at-upsert
Use correct precision when touching `updated_at` column in upsert
2021-09-14 12:21:13 -07:00
Aaron Patterson
6324abe5c3
Merge branch 'main' into use-precision-in-updated-at-upsert 2021-09-14 12:20:09 -07:00
Ryuta Kamizono
5462fbd5de
Merge pull request #43211 from 9sako6/fix_nameerror_when_an_invalid_option_is_given_to_on
Fix `NameError` when an invalid `:on` option is given to a route
2021-09-14 18:40:39 +09:00
Jannosch Müller
d574560746 Avoid comment calls in pg:dump
Fixes #36816
Fixes #43107
2021-09-13 22:33:32 +02:00
David Heinemeier Hansson
fdf5e0054a Require a version compatible with Turbo 2021-09-13 17:44:20 +02:00
David Heinemeier Hansson
ecbd92cf48
Clearer default gemfile (#43212)
* More succinct Gemfile comments

* Use double plings

* Separate gems with comments

* Correct separation at the top

* Style

* Use comments for all rails options

* Clearer still

* Clear invocation pointer

* Move tzinfo-data up to all the other gems that are available everywhere

* More succinct

* Better order and spacing

* Add similar read more link style

* No Sass recommendation on minimal
2021-09-13 11:57:54 +02:00
Haroon Ahmed
26720d5a3c Fixes an issue where an error is raised when a new rails app hits the internal rails welcome page, the exception is ActionController::RequestForgeryProtection::DisabledSessionError
Co-authored-by: Petrik de Heus <petrik@deheus.net>
2021-09-13 08:44:02 +01:00
9sako6
4af50dfd95 Fix NameError when an invalid :on option is given to a route
Fix the following error.

```
/Users/9sako6/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/bundler/gems/rails-366c8f081d8b/actionpack/lib/action_dispatch/routing/mapper.rb:1865:in `map_match': undefined local variable or method `on' for #<ActionDispatch::Routing::Mapper:0x00007fd78a132bf8> (NameError)
```
2021-09-13 16:04:11 +09:00
Jonathan Hefner
366c8f081d
Merge pull request #43210 from santib/fix-link-in-are-guides
Fix link in ActiveRecord Encryption guides [ci skip]
2021-09-12 19:17:04 -05:00
Guillermo Iguaran
203e757fd3
Merge pull request #43068 from mbayucot/42994-add-support-for-postgresql-certs-on-db-tasks
Add ssl support for postgresql database tasks
2021-09-12 16:59:01 -07:00
Guillermo Iguaran
99bc69ad28
Merge branch 'main' into 42994-add-support-for-postgresql-certs-on-db-tasks 2021-09-12 16:18:28 -07:00
Guillermo Iguaran
c0e17d4520
Merge pull request #43186 from aried3r/ar/dont_show_file_fixture_path_deprecation_if_same_path
Don't show deprecation warning for equal paths
2021-09-12 16:16:41 -07:00
Santiago Bartesaghi
8def855876 Fix link in ActiveRecord Encryption guides [ci skip] 2021-09-12 18:50:10 -03:00
Guillermo Iguaran
01fd264d00
Merge pull request #43189 from tiramizoo/good-job
Mention Good Job as Active Job backend.
2021-09-11 11:24:22 -07:00
Jorge Manrubia
f1a684ce99
Add section "Why Encrypt Data at the Application Level" to the guide (#43202)
Ref. #43115
2021-09-10 18:40:49 -07:00
Weston Ganger
0e8432e974 Remove warning when overwriting existing scopes 2021-09-10 17:00:10 -07:00