1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

80550 commits

Author SHA1 Message Date
Emma
e518999142
Update http_authentication.rb
Words such as "dead simple" are at best redundant, and at worst distracting.
2021-06-13 13:24:51 +01:00
Zachary Scott
3b1f87aded
Merge pull request from AdityaBhutani/fix-and-improve-guide-action-view-overview
[ci skip] Improved Action View Overview
2021-06-13 09:03:44 +09:00
Vipul A M
aad1ff011e
Merge pull request from AdityaBhutani/fix-and-improve-guide-action-text-overview 2021-06-13 02:49:45 +05:30
Aditya Bhutani
96a8755cf2 [ci skip] Improved Action View Overview 2021-06-13 02:48:38 +05:30
Aditya Bhutani
59b3df719d [ci skip] Corrected Grammatical Error 2021-06-13 02:36:14 +05:30
Andrew White
6d3acaf293
Merge pull request from ghiculescu/activestorage-variant-nplusone
Add support for eager loading Active Storage variants
2021-06-12 11:41:42 +01:00
Zachary Scott
3dd44a7d14
Merge pull request from ghiculescu/patch-1
Multi DB docs improvements
2021-06-12 07:58:16 +09:00
Alex Ghiculescu
8e3ad47ef2
Merge branch 'main' into activestorage-variant-nplusone 2021-06-11 12:54:09 -05:00
Alex Ghiculescu
668c5dfcfb
Multi DB docs improvements
- Clarify what the `replica` option does.
- Introduce `prevent_writes`, and remind the user that it's not perfect and the database should be configured as a replica too.
2021-06-11 11:42:11 -05:00
Jean Boussier
9a2c639a0c
Merge pull request from nateberkopec/no-exceptions
Fix hot-path raising in ActionDispatch::Static
2021-06-11 16:24:12 +02:00
Nate Berkopec
5a2cea265d
Fix hot-path raising in ActionDispatch::Static
Using File.stat where a file does not exist raises an exception.

Since ActionDispatch::Static does this:

def call(env)
  @file_handler.attempt(env) || @app.call(env)
end

... this means that around 8 exceptions are raised and rescued on each
request which is passed to the application.

This change improves latency by ~.14 milliseconds on all applications.

Partial revert of 
2021-06-11 07:56:38 -06:00
Jean Boussier
ba4fde3604
Merge pull request from Shopify/active-record-cattr-3
Get rid of `cattr_accessor` in `ActiveRecord::Base`
2021-06-11 10:12:50 +02:00
Jean Boussier
2d79790247 Make signed_id_verifier_secret a class attribute
Followup: https://github.com/rails/rails/pull/42442
2021-06-11 09:14:28 +02:00
Jean Boussier
c8932d6ec5 Make primary_key_prefix_type a class attribute
Followup: https://github.com/rails/rails/pull/42442
2021-06-11 09:12:36 +02:00
Jean Boussier
67268f1b68 Make time_zone_aware_attributes a class attribute
Followup: https://github.com/rails/rails/pull/42442
2021-06-11 09:09:57 +02:00
Jean Boussier
19c9a2046e Make index_nested_attribute_errors a module instance variable
Followup: https://github.com/rails/rails/pull/42442
2021-06-11 09:04:30 +02:00
Ryuta Kamizono
3cac9d8193 ✂️ [ci skip] 2021-06-11 14:24:06 +09:00
Ryuta Kamizono
2527682e3f Fix deprecation message s/Rails 7.0/Rails 7.1/ 2021-06-11 14:09:46 +09:00
Eileen M. Uchitelle
a466bbf62c
Merge pull request from eileencodes/fix-has_one-with-has_many-disable_joins
Fix disable_joins when join foreign key is not ID
2021-06-10 17:38:47 -04:00
eileencodes
566c4033f7
Fix disable_joins when foreign key is not ID
If you have a `has_one through` assocation where the `through` has a
`belongs_to` the foreign key won't be `id` for the joins. This change
ensures we use the correct foreign key when querying with disable joins
turned off. Prior to this change the call to `project.lead_developer`
would return `nil` if `disable_joins` was set.

Project has one lead developer through firm. Project also belongs to
firm. So when we call `project.lead_developer` it needs to find the
lead developer through the firm. In these cases we don't want to read
the owners id, we want to read the attribute that will give us the
value of the first chain item's `join_foreign_key`.
2021-06-10 16:29:34 -04:00
Jean Boussier
9bb2512485
Merge pull request from Shopify/active-record-cattr-2
Get rid of `mattr_accessor` in `ActiveRecord::Core`
2021-06-10 20:06:00 +02:00
Jean Boussier
ba877bd088 Copy config.active_record.* again when ActiveRecord::Base is loaded
Otherwise initializer files with `Rails.application.active_record.*`
might break.
2021-06-10 19:12:57 +02:00
Jean Boussier
85622b949c Move async_query confurations on the ActiveRecord module
Followup: https://github.com/rails/rails/pull/42442
2021-06-10 18:31:33 +02:00
Jean Boussier
f4a3bf06a1 Make maintain_test_schema a module instance variable
Followup: https://github.com/rails/rails/pull/42442
2021-06-10 18:31:33 +02:00
Jean Boussier
957921443a Make queues a module instance variable
Followup: https://github.com/rails/rails/pull/42442
2021-06-10 18:31:33 +02:00
Jean Boussier
03e569bcfd Make verbose_query_logs a module instance variable
Followup: https://github.com/rails/rails/pull/42442
2021-06-10 18:31:33 +02:00
Jean Boussier
bcd6c0f3d0 Convert many ActiveRecord::Base class variable into instance variables
Followup: https://github.com/rails/rails/pull/42442
2021-06-10 18:31:33 +02:00
Jean Boussier
e65042707e Make action_on_strict_loading_violation a module instance variable
Followup: https://github.com/rails/rails/pull/42442
2021-06-10 18:31:33 +02:00
Jean Boussier
a50ff734cb Get rid of the unused ActiveRecord::Base.sqlite3_production_warning 2021-06-10 18:31:33 +02:00
Jean Boussier
40f6bd0eb9 Make application_record_class a module instance variable
Followup: https://github.com/rails/rails/pull/42442
2021-06-10 18:24:38 +02:00
Jean Boussier
d0e2b00570 Make warn_on_records_fetched_greater_than a module instance variable
Followup: https://github.com/rails/rails/pull/42442
2021-06-10 18:24:38 +02:00
Jean Boussier
8ae1339ae0 Make reading_role and writing_role module instance variables
Followup: https://github.com/rails/rails/pull/42442
2021-06-10 18:24:37 +02:00
Jean Boussier
c6e4dbeebb Make default_timezone a module instance variable
Followup: https://github.com/rails/rails/pull/42442
2021-06-10 17:25:38 +02:00
Jean Boussier
48141031a6 Add x86_64-darwin-20 platform to the Gemfile
Otherwise people developping on Big Sur will have to rebundle
2021-06-10 15:33:12 +02:00
Jean Boussier
9e66e5d027
Merge pull request from Shopify/active-record-cattr-legacy-connection
Make `legacy_connection_handling` a module instance variable
2021-06-10 15:16:41 +02:00
Jean Boussier
8459c1c22f Make legacy_connection_handling a module instance variable
Ref: https://github.com/rails/rails/pull/42237
Ref: https://bugs.ruby-lang.org/issues/17763

Ruby class variables are slow, and get slower the more ancestors the class has.
And it doesn't seem likely to get faster any time soon. Overall I'm under the
impression that ruby-core consider them more or less deprecated.

But in many cases where `cattr_accessor` is used, a class instance variable
could work just fine, and would be much faster.

For Active Record this means most of the `cattr_accessor` on `ActiveRecord::Base`
could actually be `attr_accessor` on `ActiveRecord`.

I started with `legacy_connection_handling` as a proof of concept.
2021-06-10 15:00:20 +02:00
Zachary Scott
4a85239c3e
Merge pull request from daven97/daven97update_active_record_relation_wording
Revise documentation example wording - ActiveRecord::Relation#find_or_create_by [ci skip]
2021-06-10 21:37:47 +09:00
Zachary Scott
eae7043405 Add example for update_all vs. update
This is unrelated to update! and thought this might be a good place
to talk about the class method but changed my mind.

Still I think this example is valuable. [ci skip]
2021-06-10 21:07:40 +09:00
Zachary Scott
50dce5dea4 Correct changelog for to be class method instead of instance
Also added an example [ci skip]
2021-06-10 21:06:59 +09:00
Zachary Scott
1987cbd17c Expand on AR::Base for method definition from [ci skip] 2021-06-10 20:06:45 +09:00
Zachary Scott
d3e9ca92c7 Add CHANGELOG for 2021-06-10 19:40:28 +09:00
Jean Boussier
8b36cca481 Fix the Active Record test suite following fcc83e4738 2021-06-10 12:30:35 +02:00
Eugene Kenny
fcc83e4738 Fix method name in update! error message [ci skip]
Followup to 562ec582f7.
2021-06-10 08:30:16 +01:00
Rafael França
f10d814140
Merge pull request from zzak/zzak/42012
Use the current Rails->npm_version for package.json
2021-06-09 23:09:04 -04:00
Rafael França
05fe94c5b5
Merge pull request from dorianmarie/Model.update!
add Model.update! that is similar to Model.update but raises exceptions
2021-06-09 22:26:46 -04:00
Rafael França
b0d8d82760
Merge pull request from hahmed/fix-invalid-statement-compile-error
Fix invalid statement template compile error
2021-06-09 22:24:30 -04:00
Rafael França
355fb22a27
Merge pull request from FestaLab/activestorage/video-analyzer
Add metadata value for presence of audio channel in video blobs
2021-06-09 22:13:26 -04:00
Zachary Scott
f292380091
Merge pull request from SkipKayhil/as-migration-docs
[ci skip] clarify rails 6 required for AS :attachment in generator
2021-06-10 08:47:39 +09:00
Dave Nuttall
e648bf1877
Use consistent and more clear wording 2021-06-09 17:15:33 -06:00
Haroon Ahmed
1be3277a7b Fix invalid statement template compile error 2021-06-09 22:31:59 +01:00