Commit Graph

79672 Commits

Author SHA1 Message Date
Jorge Manrubia
75d186ff6e Rename property 2021-04-01 15:02:14 +02:00
Jorge Manrubia
0c2415f036 Tweak performance thresholds 2021-04-01 15:02:13 +02:00
Jorge Manrubia
87a2451d11 Fix helper reference in test 2021-04-01 15:02:13 +02:00
Jorge Manrubia
eb81a4ea3d Move encryption helper code to the general helper
If not, it will fail when processing encrypts: declaration
2021-04-01 15:02:13 +02:00
Jorge Manrubia
9341ef2f65 Remove warning due to duplicated declaration 2021-04-01 15:02:13 +02:00
Jorge Manrubia
6b4c957470 Get rid of the nested context: option
Context settings can be passed as first level options when
declaring attributes now.
2021-04-01 15:02:13 +02:00
Jorge Manrubia
6ad2df02b1 Rely on encrypted attribute type to use previous encryption schemes 2021-04-01 15:02:13 +02:00
Jorge Manrubia
a3924483fb Add missing documentation bits 2021-04-01 15:02:13 +02:00
Jorge Manrubia
1ad8bf5303 We want to exclude sqlite not target mysql 2021-04-01 15:02:13 +02:00
Jorge Manrubia
83ed6058b7 Fix tests 2021-04-01 15:02:13 +02:00
Jorge Manrubia
002198d212 Don't extend queries by default 2021-04-01 15:02:13 +02:00
Jorge Manrubia
79173314de Move tests to namespace 2021-04-01 15:02:13 +02:00
Jorge Manrubia
ae38e58ef6 Add option to support previous encryption schemes
We want to be able to support extended deterministic queries
without having to enable support_unencrypted_data
2021-04-01 15:02:13 +02:00
Jorge Manrubia
9aca274042 Encryption guide (WIP) 2021-04-01 15:02:13 +02:00
Jorge Manrubia
b06e38c224 Rename task 2021-04-01 15:02:13 +02:00
Jorge Manrubia
51aba3e0b3 Adjust performance thresholds 2021-04-01 15:02:13 +02:00
Jorge Manrubia
638a92f734 Initial extraction from active_record_encryption gem 2021-04-01 15:02:13 +02:00
Eileen M. Uchitelle
c6ee8c5c4f
Merge pull request #41810 from leequarella/forced-test_order
Revert overwriting test_order
2021-04-01 08:36:43 -04:00
Rafael França
886793bdf0
Merge pull request #41808 from p8/upgrade/sdoc-2.1.0
Upgrade sdoc to 2.1.0
2021-03-31 18:18:16 -04:00
Ricardo Díaz
1d50a37a6f Don't override ActiveSupport::TestCase.test_order
Seemingly some test suites depend on this

Updated tests to verify the change to the parallelization flag instead
2021-03-31 15:21:54 -04:00
Lee Quarella
65f350166a Remove overwriting test_order
Reverts a change from
2327ebfdc6
which can overwrite `test_order` that may have been manually set in
config. This can cause a situation where the user is depending on a
particular `test_order` but is unknowingly forced into another.
2021-03-31 11:50:08 -04:00
Petrik
85c20074f0 Upgrade sdoc to 2.1.0
Sdoc 2.1.0 works better on mobile and has improvements for SEO and
Lighthouse.

Changelog:
* #154 Make panel responsive for mobile.
* #153 Add viewport metatag to views for improved Lighthouse score.
* #150 Use semantic headers for better SEO.
2021-03-31 12:51:01 +02:00
Jean Boussier
d612542336
Merge pull request #41801 from Shopify/optimize-numeric-to-s
Optimize ActiveSupport::NumericWithFormat#to_s
2021-03-31 09:22:43 +02:00
Rafael França
e9268f73aa
Merge pull request #41791 from benkoshy/update-action-mailbox-documentation
Add: link to documentation [ci-skip]
2021-03-30 23:10:14 -04:00
BK
178b22f970 Add: link to documentation
Update guides/source/action_mailbox_basics.md

Co-authored-by: Rafael França <rafael@franca.dev>
2021-03-31 10:33:03 +11:00
Abhay Nikam
5de2dbff16 Fixes failing ActionText::ContentTest test cases
The test cases where failing because the test
`test_converts_Trix-formatted_attachments_with_custom_tag_name` set a
custom tag_name to `arbitrary-tag`. This test would also set the
ActionText::AttachmentGallery::ATTACHMENT_SELECTOR private constant
to `arbitrary-tag`.

Other test cases had proper ActionText::Attachment.tag_name set to
`action-text-attachment` but the constant once defined would not
reset.

This PR attempts to fix the issue by converting the
ActionText::AttachmentGallery::{ATTACHMENT_}SELECTOR to class methods

Fixes #41782
2021-03-30 16:38:11 -04:00
John Hawthorn
d89bb4f8ef
Merge pull request #41793 from jhawthorn/fix_buffered_log_subscriber_nil
Fix LogSubscriber for buffered event w/ nil logger
2021-03-30 09:48:29 -07:00
Jean Boussier
31c20e248a Optimize ActiveSupport::NumericWithFormat#to_s
`case format when nil` is very efficient because it end up calling `NilClass === nil`
which pretty much translates to `nil.is_a?(NilClass)`.

On the other hand `format.nil?` benefit from a dedicated op code, so it's quite faster.

In this case `Integer#to_s` is much more often called without any arguments,
so it's worth optimizing for the most common case.

```ruby
class Integer
  alias_method :faster_to_s, :to_s
end
require 'active_support/all'
require 'benchmark/ips'

module FasterNumericWithFormat
  def faster_to_s(format = nil, options = nil)
    if format.nil?
      return super()
    end

    case format
    when Integer, String
      super(format)
    when :phone
      ActiveSupport::NumberHelper.number_to_phone(self, options || {})
    when :currency
      ActiveSupport::NumberHelper.number_to_currency(self, options || {})
    when :percentage
      ActiveSupport::NumberHelper.number_to_percentage(self, options || {})
    when :delimited
      ActiveSupport::NumberHelper.number_to_delimited(self, options || {})
    when :rounded
      ActiveSupport::NumberHelper.number_to_rounded(self, options || {})
    when :human
      ActiveSupport::NumberHelper.number_to_human(self, options || {})
    when :human_size
      ActiveSupport::NumberHelper.number_to_human_size(self, options || {})
    when Symbol
      super()
    else
      super(format)
    end
  end
end

Integer.prepend(FasterNumericWithFormat)

Benchmark.ips do |x|
  x.report('orig no-arg') { 42.to_s }
  x.report('fast no-arg') { 42.faster_to_s }
  x.compare!
end

Benchmark.ips do |x|
  x.report('orig :human') { 42.to_s(:human) }
  x.report('fast :human') { 42.faster_to_s(:human) }
  x.compare!
end
```

Ruby 2.7.2
```
Warming up --------------------------------------
         orig no-arg   567.569k i/100ms
         fast no-arg   692.636k i/100ms
Calculating -------------------------------------
         orig no-arg      5.709M (± 1.3%) i/s -     28.946M in   5.070660s
         fast no-arg      6.892M (± 0.7%) i/s -     34.632M in   5.024961s

Comparison:
         fast no-arg:  6892287.7 i/s
         orig no-arg:  5709450.0 i/s - 1.21x  (± 0.00) slower

Warming up --------------------------------------
         orig :human   575.000  i/100ms
         fast :human   619.000  i/100ms
Calculating -------------------------------------
         orig :human      6.176k (± 1.6%) i/s -     31.050k in   5.028656s
         fast :human      6.179k (± 1.8%) i/s -     30.950k in   5.010372s

Comparison:
         fast :human:     6179.1 i/s
         orig :human:     6176.3 i/s - same-ish: difference falls within error

```
2021-03-30 15:41:20 +02:00
Rafael França
6675f6b785
Merge pull request #41255 from euxx/fix-create-migration-generator-with-pretend-option
Fix create migration generator with `--pretend` option
2021-03-29 22:27:34 -04:00
Rafael França
766ed57903
Merge pull request #41786 from ghiculescu/patch-4
Document `config.require_master_key` [docs] [ci-skip]
2021-03-29 20:44:38 -04:00
John Hawthorn
3a770b2197 Fix LogSubscriber for buffered event w/ nil logger
LogSubscriber overrides start/finish to avoid instrumenting when its
logger is nil. In order to support buffered notification events, as used
by async queries, we need to apply a similar override to
LogSubscriber#publish_event.
2021-03-29 17:31:07 -07:00
Ryuta Kamizono
6ce14ee4bc Address intermittent CI failure due to non-determined sort order
https://buildkite.com/rails/rails/builds/76112#1aa6023d-f58e-4c3e-96cc-027e36f2f415/973-984
2021-03-30 02:18:53 +09:00
Alex Ghiculescu
b9dfa21fbd
Document config.require_master_key [docs] [ci-skip] 2021-03-29 10:57:29 -05:00
Andrew White
bad93fe2a1
Merge pull request #41778 from rails/add-changelog-entry-for-41640
Add CHANGELOG entry for #41640
2021-03-28 09:13:48 +01:00
Andrew White
9d77ca2108
Merge pull request #41764 from steventux/41763-return-argument-error-for-parseable-invalid-iso8601-values
Raise ArgumentError from TimeZone.iso8601 instead of KeyError
2021-03-28 08:55:56 +01:00
Andrew White
7699f12dae
Add CHANGELOG entry for #41640 2021-03-28 08:15:50 +01:00
Ryuta Kamizono
f172129256 Call self.class only once in init_internals
Calling `self.class` multiple times is not cheap.

```ruby
class A
  def self.foo
  end

  def foo1
    self.class.foo
    self.class.foo
    self.class.foo
    self.class.foo
  end

  def foo2
    klass = self.class
    klass.foo
    klass.foo
    klass.foo
    klass.foo
  end
end

a = A.new

Benchmark.ips do |x|
  x.report("foo1") { a.foo1 }
  x.report("foo2") { a.foo2 }
end
```

```
Warming up --------------------------------------
                foo1   341.701k i/100ms
                foo2   414.000k i/100ms
Calculating -------------------------------------
                foo1      3.194M (± 5.4%) i/s -     16.060M in   5.044653s
                foo2      4.276M (± 3.8%) i/s -     21.528M in   5.041999s
```

Similar with #36052.
2021-03-28 11:15:12 +09:00
Ryuta Kamizono
af4ca424eb Follow up to #41765 [ci skip] 2021-03-28 10:55:35 +09:00
Ryuta Kamizono
a0097cd701 Add test case for class level strict_loading_mode 2021-03-28 10:49:15 +09:00
Ryuta Kamizono
4fe1220e57
Merge pull request #41765 from JasonBarnabe/patch-2
Specifiy association :validate option only applies to new associated objects

[ci skip]
2021-03-28 10:35:24 +09:00
George Claghorn
e3075c17ff Add frozen_string_literal pragma 2021-03-27 08:07:47 -04:00
George Claghorn
657b97e223 Active Storage representations: respond with 404 given invalid variation key 2021-03-27 08:03:27 -04:00
Rafael França
513cf351d4
Merge pull request #41770 from csutter/fix-deprecation
Fix deprecation warning on Actionpack request test
2021-03-26 14:25:28 -04:00
George Claghorn
526d630793 Upgrade to Marcel 1.0.0 2021-03-26 14:21:28 -04:00
George Claghorn
62ac25a364 Replace mimemagic with mini_mime 2021-03-26 14:20:40 -04:00
Christian Sutter
eab5a3877e Fix deprecation warning on Actionpack request test
The way this test initializes `ActionDispatch::RemoteIp` has been
deprecated in #40789. This makes the test append to the existing
trusted proxy list instead of assigning a single value.
2021-03-26 17:28:38 +00:00
Steve Laing
d4186a76c8 Raise ArgumentError from TimeZone.iso8601 when invalid value can be parsed by Date._iso8601
Date._iso8601 will return a hash for some values eg. '12936' but this will not contain the expected :mon and :mday keys.
Check for these keys and raise an ArgumentError if they aren't present as this is consistent with other invalid input behaviour.
2021-03-26 09:10:45 +00:00
Rafael França
30ef29289b
Merge pull request #41760 from Shopify/register-task-precedence
Give precedence to the DatabaseTasks registered last
2021-03-25 17:28:46 -04:00
Rafael França
d9494f9ec6
Merge pull request #41756 from c960657/patch-3
Probe with :array? instead of :oid
2021-03-25 17:08:02 -04:00
Jason Barnabe
345384fb1f
Specifiy association :validate option only applies to new associated objects
Per [code comments](6daa2d8315/activerecord/lib/active_record/associations.rb (L1418-L1420)), the `:validate` option only makes a difference for *new* objects. Existing objects are not validated, regardless of the setting.
2021-03-25 15:04:45 -05:00