- 16 9月, 2020 1 次提交
-
-
由 Jonathan Hefner 提交于
This disentangles the control flow between Action View's `translate` and I18n's `translate`. In doing so, it fixes a handful of corner cases, for which tests have now been added. It also reduces memory allocations, and improves speed when using a default: **Memory** ```ruby require "benchmark/memory" Benchmark.memory do |x| x.report("warmup") { translate(:"translations.foo"); translate(:"translations.html") } x.report("text") { translate(:"translations.foo") } x.report("html") { translate(:"translations.html") } x.report("text 1 default") { translate(:"translations.missing", default: :"translations.foo") } x.report("html 1 default") { translate(:"translations.missing", default: :"translations.html") } x.report("text 2 defaults") { translate(:"translations.missing", default: [:"translations.missing", :"translations.foo"]) } x.report("html 2 defaults") { translate(:"translations.missing", default: [:"translations.missing", :"translations.html"]) } end ``` Before: ``` text 1.240k memsize ( 0.000 retained) 13.000 objects ( 0.000 retained) 2.000 strings ( 0.000 retained) html 1.600k memsize ( 0.000 retained) 19.000 objects ( 0.000 retained) 2.000 strings ( 0.000 retained) text 1 default 4.728k memsize ( 1.200k retained) 39.000 objects ( 4.000 retained) 5.000 strings ( 0.000 retained) html 1 default 5.056k memsize ( 1.160k retained) 41.000 objects ( 3.000 retained) 4.000 strings ( 0.000 retained) text 2 defaults 7.464k memsize ( 2.392k retained) 54.000 objects ( 6.000 retained) 4.000 strings ( 0.000 retained) html 2 defaults 7.944k memsize ( 2.384k retained) 60.000 objects ( 6.000 retained) 4.000 strings ( 0.000 retained) ``` After: ``` text 952.000 memsize ( 0.000 retained) 9.000 objects ( 0.000 retained) 1.000 strings ( 0.000 retained) html 1.008k memsize ( 0.000 retained) 10.000 objects ( 0.000 retained) 1.000 strings ( 0.000 retained) text 1 default 2.400k memsize ( 40.000 retained) 24.000 objects ( 1.000 retained) 4.000 strings ( 0.000 retained) html 1 default 2.464k memsize ( 0.000 retained) 22.000 objects ( 0.000 retained) 2.000 strings ( 0.000 retained) text 2 defaults 3.232k memsize ( 0.000 retained) 30.000 objects ( 0.000 retained) 2.000 strings ( 0.000 retained) html 2 defaults 3.456k memsize ( 0.000 retained) 32.000 objects ( 0.000 retained) 2.000 strings ( 0.000 retained) ``` **Speed** ```ruby require "benchmark/ips" Benchmark.ips do |x| x.report("text") { translate(:"translations.foo") } x.report("html") { translate(:"translations.html") } x.report("text 1 default") { translate(:"translations.missing", default: :"translations.foo") } x.report("html 1 default") { translate(:"translations.missing", default: :"translations.html") } x.report("text 2 defaults") { translate(:"translations.missing", default: [:"translations.missing", :"translations.foo"]) } x.report("html 2 defaults") { translate(:"translations.missing", default: [:"translations.missing", :"translations.html"]) } end ``` Before: ``` text 35.685k (± 0.7%) i/s - 179.050k in 5.017773s html 28.569k (± 3.1%) i/s - 143.871k in 5.040128s text 1 default 13.953k (± 2.0%) i/s - 70.737k in 5.071651s html 1 default 12.507k (± 0.4%) i/s - 63.546k in 5.080908s text 2 defaults 9.103k (± 0.3%) i/s - 46.308k in 5.087323s html 2 defaults 8.570k (± 4.3%) i/s - 43.071k in 5.034322s ``` After: ``` text 36.694k (± 2.0%) i/s - 186.864k in 5.094367s html 30.415k (± 0.5%) i/s - 152.900k in 5.027226s text 1 default 18.095k (± 2.7%) i/s - 91.086k in 5.036857s html 1 default 15.934k (± 1.7%) i/s - 80.223k in 5.036085s text 2 defaults 12.179k (± 0.6%) i/s - 61.659k in 5.062910s html 2 defaults 11.193k (± 2.1%) i/s - 56.406k in 5.041433s ```
-
- 12 9月, 2020 1 次提交
-
-
由 Jonathan Hefner 提交于
This refactor incidentally fixes a corner case when `translate` is called with a block, the translation is missing, and `debug_missing_translation` is false. This commit adds a test for the above corner case, and additional tests for existing behavior.
-
- 11 9月, 2020 2 次提交
-
-
由 Eileen M. Uchitelle 提交于
Rename Error#detail method as details
-
由 lulalala 提交于
Plural is more expected.
-
- 10 9月, 2020 5 次提交
-
-
由 Ryuta Kamizono 提交于
Update Minitest to allow installation with Ruby 3.
-
由 Jonathan Hefner 提交于
Prior to this commit, when a translation key indicated that the translation text was HTML, the value returned by `I18n.translate` would always be marked as `html_safe`. However, the value returned by `I18n.translate` could be an untrusted value directly from `options[:default]`. This commit ensures values directly from `options[:default]` are not marked as `html_safe`.
-
由 Jonathan Hefner 提交于
Prior to this commit, when a translation key indicated that the translation text was HTML, the value returned by `I18n.translate` would always be marked as `html_safe`. However, the value returned by `I18n.translate` could be an untrusted value directly from `options[:default]`. This commit ensures values directly from `options[:default]` are not marked as `html_safe`.
-
由 Jonathan Hefner 提交于
Prior to this commit, when a translation key indicated that the translation text was HTML, the value returned by `I18n.translate` would always be marked as `html_safe`. However, the value returned by `I18n.translate` could be an untrusted value directly from `options[:default]`. This commit ensures values directly from `options[:default]` are not marked as `html_safe`.
-
- 09 9月, 2020 5 次提交
-
-
由 Ryuta Kamizono 提交于
-
https://github.com/rails/rails/pull/40178#issuecomment-688222844由 Ryuta Kamizono 提交于
It is a common use case especially for MySQL users.
-
由 Ryuta Kamizono 提交于
Revert #40178
-
由 John Hawthorn 提交于
Use a unique controller class per ActionView::TestCase
-
由 KapilSachdev 提交于
This reverts commit b8ab1f89, reversing changes made to 73ae5655.
-
- 08 9月, 2020 8 次提交
-
-
由 Eugene Kenny 提交于
Properly support `reverse_order` on relations with `nulls_first` or `nulls_last` calls
-
由 Kevin Deisz 提交于
If you're using the `nulls_first` or `nulls_last` functionality with an explicit ordering, then previously it wasn't properly handling calls to `#reverse` (called through `reverse_order`). This commit changes the behavior to match what would be expected.
-
由 Eugene Kenny 提交于
It's faster on Ruby 2.7+ since it avoids rehashing the keys.
-
由 Eugene Kenny 提交于
These methods are PostgreSQL-specific, and all supported versions of PostgreSQL support validating constraints.
-
由 Eugene Kenny 提交于
Add support for `NOT VALID` check constraints in PostgreSQL
-
由 Alex Robbin 提交于
Active Record already supports adding `NOT VALID` foreign key constraints in PostgreSQL, but back in #31323 when check constraint support was initially added, the ability to add a check constraint and validate it separately was not included. This adds that functionality!
-
由 Eugene Kenny 提交于
Anchor BacktraceCleaner gem filter regexp
-
由 Jonathan Hefner 提交于
This ensures the default gem filter does not affect backtrace lines that have a subpath incidentally matching a gem path. Fixes #40196.
-
- 07 9月, 2020 5 次提交
-
-
由 Muhammad Usman 提交于
Closes #40187.
-
由 Eugene Kenny 提交于
Update Gemfile.lock with rubocop-packaging
-
由 Eugene Kenny 提交于
Load Rails tasks for each new Rake::Application
-
由 Jonathan Hefner 提交于
Follow-up to #40185.
-
由 Jonathan Hefner 提交于
Follow-up to #40143. Rails Rake tasks are loaded for each new `Rake::Application` instance via `Rails.application.load_tasks`. However, under the hood, `Rails.application.load_tasks` used `require` instead of `load`, which caused Rails tasks to be loaded for only the first `Rake::Application` instance. This commit changes the relevant `require` to `load`. Fixes #40184.
-
- 06 9月, 2020 8 次提交
-
-
由 Ryuta Kamizono 提交于
Update RuboCop to v0.90
-
由 Utkarsh Gupta 提交于
Signed-off-by: NUtkarsh Gupta <utkarsh@debian.org>
-
由 Eugene Kenny 提交于
Add explain to abstract database statements.
-
由 Eugene Kenny 提交于
Support reversing of Arel expressions in reverse_order, last etc.
-
由 Kasper Timm Hansen 提交于
Shorten inspect on ActionDispatch::Request
-
由 Kasper Timm Hansen 提交于
Shorten inspect on AbstractController::Base
-
由 Petrik 提交于
Calling self in an action of a controller generates an endless stream of characters, including the request object and all instances variables. This can be frustrating when using a debugger in a controller and accidentally calling `self` generates output for a couple of seconds. This shortens inspect to only show the class name. MyController.new.inspect # => "#<MyController:0x00000000005028>"
-
由 Petrik 提交于
Calling request in an action of a controller generates an endless stream of characters, including the Rack app and middlewares. This can be frustrating when using a debugger in a controller and accidentally calling `request` generates output for a couple of seconds. Inspect on ActionDispatch::Request is shortened to the most relevant attributes and uses the same format as used for request in the logs: "#<ActionDispatch::Request POST "https://example.com/path/of/some/uri?q=1" for 1.2.3.4>"
-
- 05 9月, 2020 1 次提交
-
-
由 Kasper Timm Hansen 提交于
Reduce allocations in expanded_version and expanded_key
-
- 04 9月, 2020 4 次提交
-
-
由 Eileen M. Uchitelle 提交于
Disconnect connections used for acquiring advisory lock in migration.
-
由 Eileen M. Uchitelle 提交于
Raise error when `from` is used with `delete_all`.
-
由 Eileen M. Uchitelle 提交于
Avoid setting `ActiveRecord::Base.configurations` twice in db rake ta…
-
由 Guo Xiang Tan 提交于
This prevents the `from` query method from being ignored silently in the resulting SQL query that is generated.
-