Skip to content

Commit 8e3ad47

Browse files
authored
Merge branch 'main' into activestorage-variant-nplusone
2 parents c39d486 + 9a2c639 commit 8e3ad47

File tree

154 files changed

+1393
-689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+1393
-689
lines changed

Gemfile.lock

Lines changed: 64 additions & 97 deletions
Large diffs are not rendered by default.

actionmailer/lib/action_mailer/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ def self.supports_path? # :doc:
901901
end
902902

903903
def apply_defaults(headers)
904-
default_values = self.class.default.transform_values do |value|
904+
default_values = self.class.default.except(*headers.keys).transform_values do |value|
905905
compute_default(value)
906906
end
907907

actionmailer/test/base_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,14 @@ def self.previewing_email(mail); end
833833
assert_equal("Thanks for signing up this afternoon", mail.subject)
834834
end
835835

836+
test "proc default values are not evaluated when overridden" do
837+
with_default BaseMailer, from: -> { flunk }, to: -> { flunk } do
838+
email = BaseMailer.welcome(from: "[email protected]", to: "[email protected]")
839+
assert_equal ["[email protected]"], email.from
840+
assert_equal ["[email protected]"], email.to
841+
end
842+
end
843+
836844
test "modifying the mail message with a before_action" do
837845
class BeforeActionMailer < ActionMailer::Base
838846
before_action :add_special_header!

actionpack/lib/action_dispatch/middleware/static.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,8 @@ def try_precompressed_files(filepath, headers, accept_encoding:)
137137
end
138138

139139
def file_readable?(path)
140-
file_stat = File.stat(File.join(@root, path.b))
141-
rescue SystemCallError
142-
false
143-
else
144-
file_stat.file? && file_stat.readable?
140+
file_path = File.join(@root, path.b)
141+
File.file?(file_path) && File.readable?(file_path)
145142
end
146143

147144
def compressible?(content_type)

actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<%= @exception.message %>
77
<% if defined?(ActiveStorage) && @exception.message.match?(%r{#{ActiveStorage::Blob.table_name}|#{ActiveStorage::Attachment.table_name}}) %>
88
To resolve this issue run: bin/rails active_storage:install
9+
<% end %>
910
<% if defined?(ActionMailbox) && @exception.message.match?(%r{#{ActionMailbox::InboundEmail.table_name}}) %>
1011
To resolve this issue run: bin/rails action_mailbox:install
1112
<% end %>

actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ def take_screenshot
4040
# Takes a screenshot of the current page in the browser if the test
4141
# failed.
4242
#
43-
# +take_failed_screenshot+ is included in <tt>application_system_test_case.rb</tt>
44-
# that is generated with the application. To take screenshots when a test
45-
# fails add +take_failed_screenshot+ to the teardown block before clearing
46-
# sessions.
43+
# +take_failed_screenshot+ is called during system test teardown.
4744
def take_failed_screenshot
4845
take_screenshot if failed? && supports_screenshot?
4946
end

actionpack/test/controller/render_test.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class TestControllerWithExtraEtags < ActionController::Base
99
"test/hello_world.erb" => "Hello world!"
1010
)]
1111

12-
def self.controller_name; "test"; end
1312
def self.controller_path; "test"; end
1413

1514
etag { nil }

actionview/lib/action_view/helpers/javascript_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module ActionView
44
module Helpers #:nodoc:
55
module JavaScriptHelper
66
JS_ESCAPE_MAP = {
7-
'\\' => '\\\\',
7+
"\\" => "\\\\",
88
"</" => '<\/',
99
"\r\n" => '\n',
1010
"\n" => '\n',

actionview/lib/action_view/template/handlers/erb.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ class ERB
1616
# Do not escape templates of these mime types.
1717
class_attribute :escape_ignore_list, default: ["text/plain"]
1818

19+
# Strip trailing newlines from rendered output
20+
class_attribute :strip_trailing_newlines, default: false
21+
1922
ENCODING_TAG = Regexp.new("\\A(<%#{ENCODING_FLAG}-?%>)[ \\t]*")
2023

2124
def self.call(template, source)
@@ -45,6 +48,9 @@ def call(template, source)
4548
# Always make sure we return a String in the default_internal
4649
erb.encode!
4750

51+
# Strip trailing newlines from the template if enabled
52+
erb.chomp! if strip_trailing_newlines
53+
4854
options = {
4955
escape: (self.class.escape_ignore_list.include? template.type),
5056
trim: (self.class.erb_trim_mode == "-")

actionview/lib/action_view/test_case.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ def controller_path=(path)
2424
self.class.controller_path = path
2525
end
2626

27+
def self.controller_name
28+
"test"
29+
end
30+
2731
def initialize
2832
super
2933
self.class.controller_path = ""

0 commit comments

Comments
 (0)