https://github.com/rails/rails/pull/46678 introduced a regression, if you do the following:
```ruby
= time_field(model, attr, value: "01:45")
```
Previously it would render an input with `value="01:45"`, since https://github.com/rails/rails/pull/46678 it renders a value with seconds (`value="01:45:00.000"`). This is a regression from Rails 7. See https://github.com/rails/rails/pull/41728 for why you might want the value to be rendered without seconds.
Co-authored-by: jonathanhefner <jonathan@hefner.pro>
```
Failure:
Rails::Command::HelpIntegrationTest#test_prints_help_via_`X:help`_command_when_running_`X`_and_`X:X`_command_is_not_defined [/Users/zzak/code/rails/railties/t
est/command/help_integration_test.rb:33]:
--- expected
+++ actual
@@ -1,4 +1,5 @@
-"Commands:
+"Rack::Server is deprecated and replaced by Rackup::Server
+Commands:
bin/rails dev:cache # Toggle development mode caching on/off
bin/rails dev:help [COMMAND] # Describe available commands or one specific...
```
From @ioquatix:
> Yeah you need to load `rackup/server` and if you get `LoadError` fall back to `Rack::Server`.
This PR implements that paraphrasing, and resolves this deprecation:
```
Rack::Server is deprecated and replaced by Rackup::Server
```
Example build:
https://buildkite.com/rails/rails/builds/95468#0187559d-3190-4e6f-8ac5-65042b2a5412/1334-1342
Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
In 15369fd we introduced the ability to infer the foreign_key for a model using `inverse_of`.
In some association configurations, such as when there is a `has_one` that is the inverse of another `has_one` association, this inference causes infinite recursion.
This addresses that by adding a param to `Reflection#foreign_key` to indicate whether to infer from `inverse_of`, and in `#derive_foreign_key` we explicitly disable this behavior when calling `#foreign_key` on the inverse association.
Without carefully reading examples or the source code it's not clear that
.sanitize_sql_for_conditions and .sanitize_sql_for_assignment methods won't
sanitize strings and will result in a no-op. This is an attempt to raise
awareness of this unexpected behaviour from a method aliased as `.sanitize_sql`.
The PR documents this change:
https://github.com/rails/rails/pull/21535
Which allows multiple contexts to be validated:
person.valid?([:create, :update]) # => true
The change isn't visible in the API documentation which this PR
fixes.
This commit ensures that the composite primary key is reset when
`#dup` is called on an instance of an `ActiveRecord::Base` subclass.
For example:
```ruby
class TravelRoute < ActiveRecord::Base
self.primary_key = [:origin, :destination]
end
route = TravelRoute.new(origin: "NYC", destination: "LAX")
route.dup # => #<TravelRoute origin: nil, destination: nil>
```
Your Gemfile lists the gem rake (>= 13) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Previously, if you were using a pre-7.1 migration and you were adding an index using `create_table`, the index would be named using the new index naming functionality introduced in #47753.
If you're using MySQL 8.0.16+ and your database contains a table with
a check constraint, the first and last characters of the constraint
will be stripped when dumping the schema; this makes it impossible
to use check constraints in a MySQL 8.0 database with the `:ruby`
schema format; once dumped, they cannot be re-imported.
This is because, up until MySQL 8.0.16, all check constraints were
surrounded by an extra set of parentheses; this behaviour differed
from that presented by MariaDB, which handled them correctly thanks
to an engine check within the AbstractMySqlAdapter.
With this change, we only strip the parentheses if they are present,
which prevents the corruption of the constraint.
It is also possible that the exported check constraint will contain
invalid and unexpected whitespace characters; we handle that here too,
stripping out sequences of `\\` and `\n`, as well as any other
whitespace.