| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Added missing tests for transform_values! which returns Enumerator
|
| |
| |
| |
| | |
blocks
|
|\ \
| | |
| | | |
Correcting `ActiveRecord::ReadOnlyRecord` Error Message [ci skip]
|
| | | |
|
|/ / |
|
|\ \
| | |
| | | |
Added missing tests for transform_keys! which returns Enumerator
|
| |/ |
|
|\ \
| | |
| | | |
fix Mime type in doc since mime types via constants is deprecated [ci…
|
| |/ |
|
| | |
|
| |
| |
| |
| |
| |
| | |
We only want to activate flash when the user has enabled it. Api
servers don't use flash, so add an empty implementation to the base
Request object.
|
| | |
|
| |
| |
| |
| |
| | |
Committing the flash needs to happen in order for the session to be
written correctly, so lets guarantee that it actually does happen.
|
| |
| |
| |
| |
| | |
I'm doing this so that we can commit the flash to the session object Out
of Band of the flash middleware
|
|\ \
| | |
| | | |
docs, add missing closing bracket. [ci skip]
|
| |/ |
|
|\ \
| |/
|/| |
Fixed humane -> human [ci skip]
|
|/ |
|
|\
| |
| | |
[Engines Guide] Remove to_s example, since it's outside the scope
|
| |
| |
| |
| |
| |
| | |
It's outside the scope of the Engines guide
[skip ci]
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The implementation of `attribute_method?` on Active Record requires
establishing a database connection and querying the schema. As a general
rule, we don't want to require database connections for any class macro,
as the class should be able to be loaded without a database (e.g. for
things like compiling assets).
Instead of eagerly defining these methods, we do it lazily the first
time they are accessed via `method_missing`. This should not cause any
performance hits, as it will only hit `method_missing` once for the
entire class.
|
|\ \
| | |
| | | |
Quote prepared statements of `sanitize_sql_array`
|
| | |
| | |
| | |
| | |
| | |
| | | |
Sure unquoted SQL code pass test, but this % style prepared statements
are dangerous. Test codes and code examples are also "Rails" codes,
so quote placeholder of prepared statements.
|
|\ \ \
| | | |
| | | | |
Fix deprecated mime types via constants
|
|/ / /
| | |
| | | |
Accessing mime types via constants is deprecated. Now, we are using `Mime::Type[:JSON]` instead of `Mime::JSON`
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This was passing prior to 20b177b78ef5d21c8cc255f0376f6b2e948de234,
because we were not properly applying our contract that
`model.attr == model.tap(&:save).reload.attr` for this case. Now that
that has been resolved, this test is invalid on some adapters
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When a time object was assigned to a datetime column, the decorator for
TZ aware attributes wouldn't call super, so when using a database
without support for subsecond precision, the nanosecond would not be
truncated, leading to the value being marked as changed.
Interestingly, this also shows our new implementation of dirty checking
to be more robust than the old one (with less code and better
performance! :tada:!!!)
|
| | |
| | |
| | |
| | | |
They didn't help.
|
| | |
| | |
| | |
| | |
| | | |
Use the Rack utility methods for functional header manipulation. This
helps to eliminate coupling on the header hash
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I want to move the header hash to the super request object in order to
consolidate behavior. We should be switching out buffering strategies
rather than header strategies since things like "mutating headers after
send" is an error in both cases (buffering vs streaming).
|
| | |
| | |
| | |
| | | |
We should not mutate headers after the response has been committed.
|
| | |
| | |
| | |
| | | |
Nobody can replicate locally and the failure makes no sense
|
| | |
| | |
| | |
| | |
| | |
| | | |
When I removed the call to `super` to avoid the setting of
`@previous_changes`, I forgot to duplicate the other part of that
behavior, which led to failing tests
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The biggest source of the performance regression in these methods
occurred because dirty tracking required eagerly materializing and type
casting the assigned values. In the previous commits, I've changed dirty
tracking to perform the comparisons lazily. However, all of this is moot
when calling `save`, since `changes_applied` will be called, which just
ends up eagerly materializing everything, anyway. With the new mutation
tracker, it's easy to just compare the previous two hashes in the same
lazy fashion.
We will not have aliasing issues with this setup, which is proven by the
fact that we're able to detect nested mutation.
Before:
User.create! 2.007k (± 7.1%) i/s - 10.098k
After:
User.create! 2.557k (± 3.5%) i/s - 12.789k
Fixes #19859
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In order to improve the performance of dirty checking, we're going to
need to duplicate all of the `previous_` methods in Active Model.
However, these methods are basically the same as their non-previous
counterparts, but comparing `@original_attributes` to
`@previous_original_attributes` instead of `@attributes` and
`@original_attributes`. This will help reduce that duplication.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This moves a bit more of the logic required for dirty checking into the
attribute objects. I had hoped to remove the `with_value_from_database`
stuff, but unfortunately just calling `dup` on the attribute objects
isn't enough, since the values might contain deeply nested data
structures. I think this can be cleaned up further.
This makes most dirty checking become lazy, and reduces the number of
object allocations and amount of CPU time when assigning a value. This
opens the door (but doesn't quite finish) to improving the performance
of writes to a place comparable to 4.1
|
|\ \ \
| | | |
| | | | |
Make `assert_difference` return the result of the yielded block.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
With this we can perform new assertions on the returned value without having
to cache it with an outer variable or wrapping all subsequent assertions inside
the `assert_difference` block.
Before:
```
post = nil
assert_difference -> { Post.count }, 1 do
Post.create
end
assert_predicate post, :persisted?
```
Now:
```
post = assert_difference -> { Post.count } do
Post.create
end
assert_predicate post, :persisted?
```
|
|\ \ \ \
| | | | |
| | | | | |
Fix typo in ignored_columns test [skip ci]
|
|/ / / /
| | | |
| | | |
| | | | |
Follow-up to #21720.
|
|\ \ \ \
| |_|/ /
|/| | | |
Implement ActiveRecord::Base.ignored_columns
|
|/ / / |
|
|\ \ \
| | | |
| | | |
| | | | |
ActiveRecord: use association's `unscope` when preloading
|
| | | | |
|
|\ \ \ \
| |_|/ /
|/| | |
| | | | |
Fix a bug with returning_disabled when using the postgresql adapter
|
| | | |
| | | |
| | | |
| | | | |
The returning_disabled configuration option is required to make postgresql partitioning triggers work. This commit fixes a bug where an invalid query would be made in cases where returning_disabled was true and objects were created with no attributes defined.
|
|\ \ \ \
| | | | |
| | | | | |
Improve readability of docs by using code tag [ci skip]
|
|/ / / / |
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
[ci skip]
[Action View Overview Guide] Add note about Jbuilder
|
| | |_|/
| |/| |
| | | |
| | | | |
[skip ci]
|