Commit Graph

92966 Commits

Author SHA1 Message Date
Rafael Mendonça França ed1991b8ac
Merge pull request #52962 from rails/rm-releser
New release process using Trusted Publishing
2024-09-25 10:18:07 -04:00
Vipul A M d6e250d406
Merge pull request #53037 from zalom/docs-fix-getting-started-devcontainer-tip
[ci skip] Remove leftover artifact from getting started with Dev Container tip
2024-09-25 17:41:15 +05:30
Zlatko Alomerovic ebb32738f4
[ci skip] Remove leftover artifact from tip 2024-09-25 11:53:30 +00:00
Ryuta Kamizono f518ab8946
Merge pull request #53032 from fatkodima/fix-query-building-for-large-tuple-values
Fix query building for `where` with tuple syntax and large values list
2024-09-25 17:04:41 +09:00
Eugene Kenny 490004e35e Update Gemfile.lock for sqlite3 2.1
Followup to 9e9f80778a.
2024-09-25 08:32:52 +01:00
Eugene Kenny 79056f9765
Merge pull request #53034 from skipkayhil/hm-eqc-allocation
Rm array allocation in {en,dis}able_query_cache!
2024-09-25 08:29:12 +01:00
Jean Boussier 9e9f80778a
Merge pull request #53033 from flavorjones/flavorjones-hush-sqlite3-forksafety-warnings 2024-09-24 20:59:25 -04:00
Hartley McGuire f4d0a8e5ee
Merge pull request #52207 from aeroastro/patch-1
[DOC] Remove wrong document due to refactoring `attribute`
2024-09-24 23:03:47 +00:00
Hartley McGuire 6e15d5a604
Rm array allocation in {en,dis}able_query_cache!
When `dirties` was [added][1] as an option to `uncached`,
`{en,dis}able_query_cache!` were changed to use multiple assignment.
However, multiple assignment allocates an array and is not really
necessary for these methods.

[1]: 5d528ba0c8

Surprisingly, this showed up in a production profile as a large
allocator.

Reproduction:

```ruby
require "active_record"
require "memory_profiler"

ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")

report = MemoryProfiler.report do
  10000.times do
    ActiveRecord::Base.connection.enable_query_cache!
  end
end

report.pretty_print
```

Before:

```
bundle exec ruby eqc.rb | rg "allocated objects by class" -A 10
allocated objects by class
-----------------------------------
     10093  Array
      1551  String
        12  Class
         7  Hash
         3  File
         2  Proc
         2  Thread::Backtrace
         2  Thread::Backtrace::Location
         2  Thread::Mutex
```

After:

```
bundle exec ruby eqc.rb | rg "allocated objects by class" -A 10
allocated objects by class
-----------------------------------
      1551  String
        93  Array
        12  Class
         7  Hash
         3  File
         2  Proc
         2  Thread::Backtrace
         2  Thread::Backtrace::Location
         2  Thread::Mutex
```
2024-09-24 18:47:26 -04:00
Jean Boussier dee911b24a
Merge pull request #53023 from fatkodima/simplify-model_schema-columns
Simplify `ActiveRecord::ModelSchema.columns` method
2024-09-24 17:08:44 -04:00
Mike Dalessio 7c34062b38
Update dependency on sqlite3 gem to >= 2.1
This version contains protections against sqlite's lack of fork
safety. We also suppress the warnings related to forking with open
writable connections, despite the lost memory per-connection.

For more context, see:
https://github.com/sparklemotion/sqlite3-ruby/blob/main/adr/2024-09-fork-safety.md
2024-09-24 17:02:42 -04:00
fatkodima 5ff57a5e90
Merge pull request #53029 from jgsheppa/52852_nulls_not_distinct_documentation
Add documentation for `nulls_not_distinct` option to `add_index` [ci skip]
2024-09-24 20:39:52 +03:00
fatkodima ec9e64dc9e Fix query building for `where` with tuple syntax and large values list 2024-09-24 20:29:24 +03:00
jgsheppa add6b17792 Add documentation for nulls_not_distinct
Adds API documentation for the nulls_not_distinct option for
ActiveRecord::ConnectionAdapters::SchemaStatements.add_index.

Resolves issue #52852.
2024-09-24 14:26:20 +00:00
fatkodima 31ae8a88cb Simplify `ActiveRecord::ModelSchema.columns` method 2024-09-24 01:37:55 +03:00
Sean Doyle fd975a8775
Revert changes to `delegated_type` in #50280 (#53016)
Automatically inferring `:inverse_of` is incompatible with records that
do not declare inverse associations.

Revert for the sake of the impending release.
2024-09-23 09:17:49 -07:00
Ryuta Kamizono a5d1e10449
Merge pull request #53014 from fatkodima/fix-inspect-for-singleton-classes
Fix `#inspect` for ActiveRecord singleton classes
2024-09-23 21:48:32 +09:00
fatkodima 43490d0ed2 Fix `#inspect` for ActiveRecord singleton classes 2024-09-23 15:33:53 +03:00
Ryuta Kamizono 31818edb03
Merge pull request #53005 from fkmy/fix-migration-version-in-guide
[ci-skip][docs] Fix version of the migration in the guide to the current Rails version
2024-09-22 05:56:31 +09:00
fatkodima 9c41f5828c
Include controller path into cache keys for rate limiters (#52961) 2024-09-21 09:41:31 -07:00
Jerome Dalbert cde7ffee30
Make `kamal dbc` work with any database (#53003) 2024-09-21 09:40:17 -07:00
fkmy 8b901bb1ef Fix version of the migration in the guide to the current Rails version 2024-09-21 20:53:33 +09:00
Rafael Mendonça França aeb0fa4bcc
Merge pull request #53002 from skipkayhil/hm-rm-cache-key-allocation
Remove hash allocation in Store#namespace_key
2024-09-20 20:47:05 -04:00
David Heinemeier Hansson 7673e8fb1d Excess comment marker 2024-09-20 17:15:51 -07:00
Hartley McGuire b87e1e6163
Remove hash allocation in Store#namespace_key
Previously, every call to `namespace_key` would merge the options given
with the Store's default options. This unnecessarily allocates a new
hash when all `namespace_key` needs is the `namespace` option.

This commit removes the allocation by simply checking the default
options after checking that the passed options do not contain a
`namespace` key.
2024-09-20 20:09:00 -04:00
David Heinemeier Hansson e02419475d Expose the option to change the log level via ENV 2024-09-20 17:02:05 -07:00
David Heinemeier Hansson 34ea0a5dd2 Bump Kamal 2 to rc2 2024-09-20 15:45:13 -07:00
David Heinemeier Hansson c052270f9b Group related log toggles together 2024-09-20 15:33:15 -07:00
David Heinemeier Hansson 87feb28905 Needless repetition
That config is just below
2024-09-20 15:32:40 -07:00
David Heinemeier Hansson 294ded8112 Explain each setting by itself when they are independent 2024-09-20 15:31:13 -07:00
David Heinemeier Hansson 15817ffed1
Cleanup default environment files (#52999)
* Less verbose explanation

* Default Dockerfile config takes care of this with dummy key

* This is an common setup to need

* Less verbose

* Explain what default is

* Real is a weak placeholder for a hint at default

* Not needed for most out the box

* Group together with other logging concerns

* Not needed any more

* Be more succinct

* Not needed

* Never made any sense for testing?

* Fix test

* Default was true, so we still need this

* We dont need to turn this off either

* Slightly broader
2024-09-20 15:26:58 -07:00
Jerome Dalbert 516135e394
Stop ignoring old `.env.erb` files from Kamal 1 (#53000)
`.env.erb` files are not generated any more in new Rails apps, so this commit removes them from the ignore files. Kamal 2 now manages secrets with .kamal/secrets, and this file is meant to be safe for git by
default.
2024-09-20 15:11:23 -07:00
Rafael Mendonça França 6929047298
Add release workflow
Don't push the gems to rubygems manually anymore

We are going to do in the GithUb action.
2024-09-20 20:03:30 +00:00
David Heinemeier Hansson 592a52b937
Add TaggedLogging#logger constructor for more pleasant logging interface (#52994) 2024-09-20 12:09:40 -07:00
Rafael Mendonça França 640d0f6ab5
Merge pull request #52988 from FrancescoK/fix-52896
Fix #52986
2024-09-20 14:49:37 -04:00
Rafael Mendonça França 1a1cae0d99
Merge pull request #52992 from excid3/fix-ci-railtie-test-command
Generate the correct bin/test command for railtie CI config
2024-09-20 14:34:53 -04:00
David Heinemeier Hansson 759f2cb42a
Container logging already has built-in timestamps (#52993)
It just makes the logs more unreadable when you have them doubled up by
default.
2024-09-20 11:20:34 -07:00
Francesco Kirchhoff 830ab5870d
Fix #52986
A freshly generated Rails project includes a Rubocop linter violation in this line. This edits the file to stick to the listing rules a new Rails project is shipped with by default.
2024-09-20 18:00:38 +00:00
Rafael Mendonça França c415502814
Merge pull request #52983 from fatkodima/validate-uniqueness-with-singleton-class
Fix uniqueness validations defined on singleton classes
2024-09-20 13:34:41 -04:00
Chris Oliver 4d591da1ab
Generate the correct bin/test command for railtie CI config 2024-09-20 11:48:22 -05:00
David Heinemeier Hansson 97169912f1 Use the correct format for kamal secrets in the comment 2024-09-19 16:53:26 -07:00
John Hawthorn 9de4972ade
Merge pull request #52978 from intrip/fix-infinite-loop-for-dependency-with-non-trailing-interpolation
Fix infinite loop computing ERB dependencies with non-trailing interpolations
2024-09-19 15:54:22 -07:00
fatkodima e35b907a0b Fix uniqueness validations defined on singleton classes 2024-09-20 00:06:58 +03:00
David Heinemeier Hansson 6360b73599
Kamal 2 compatible configuration (#52883)
* Prepare deploy.yml for new Kamal 2 options

* Use Kamal 2 secrets instead of .env

* With Kamal 2 being default, and Cloudflare being common, this is the better production default

* Add default far-future expiry for Thruster

* Just while we are waiting for Kamal 2 to drop

* Update for new secrets location

* Latest turbo-rails

* Dont use Redis for Action Cable when we have Solid Cable

* Remote config changed too

* Add a kamal alias for sqlite db console when appropriate

* No longer relevant

Thruster does this now

* No longer relevant either

Thruster territory

* No longer relevant

* Update railties/lib/rails/generators/app_base.rb

Co-authored-by: Jerome Dalbert <jerome.dalbert@gmail.com>

* Proxy branch was merged

* Update railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt

Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>

* Use beta1

* Redis only recommended when solid is skipped

* Use the Kamal 2 beta1

* Use Kamal 2 beta2

---------

Co-authored-by: Jerome Dalbert <jerome.dalbert@gmail.com>
Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>
2024-09-19 14:04:36 -07:00
intrip 773d640cf1 Fix infinite loop computing ERB dependencies with non-trailing interpolations
Calling
```ruby
ActionView::DependencyTracker::ERBTracker#add_static_dependency( []  "test/\#{bucket.bucketable_name.pluralize}/status/show" "\"")
```
Will loop indefinitely. Fixes it by parsing only template strings with a trailing template interpolation.

Co-authored-by: Hartley McGuire @skipkayhil
2024-09-19 21:12:53 +02:00
John Hawthorn 2ccd3bff72
Merge pull request #52969 from ghiculescu/am-serializable_hash-order
Ensure consistent sort order in `ActiveModel#serializable_hash` when using `only` option
2024-09-19 11:28:41 -07:00
Ryuta Kamizono c4637037b0
Merge pull request #52974 from maciej-ka/docs-api-app-accelerated-sendfile-reason
docs: add one sentence reason for having accelerated sendfile [ci-skip]
2024-09-20 03:14:29 +09:00
Ryuta Kamizono aaa6c5eb28
Merge pull request #52976 from maciej-ka/docs-api-app-update-jquery-example-to-fetch
docs: update jQuery ajax to fetch in api app guide
2024-09-20 03:10:32 +09:00
Rafael Mendonça França 19ab2b8a9c
Merge pull request #52972 from bogdan/optimize-class-lookup-in-uniqueness-validation
Optimize AR uniqueness validator class hierarchy lookup
2024-09-19 14:06:30 -04:00
Rafael Mendonça França ae3feb744e
Merge pull request #52975 from aidanharan/fix-rails-info-controller-test
Updated `rails_info_controller_test.rb` test so it tests correctly
2024-09-19 14:04:33 -04:00