提交 a2bd669e 编写于 作者: E eileencodes

Merge tag 'v6.0.0.beta3'

v6.0.0.beta3 release
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* PostgreSQL subscription adapters now support `channel_prefix` option in cable.yml * PostgreSQL subscription adapters now support `channel_prefix` option in cable.yml
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
{ {
"name": "@rails/actioncable", "name": "@rails/actioncable",
"version": "6.0.0-beta2", "version": "6.0.0-beta3",
"description": "WebSocket framework for Ruby on Rails.", "description": "WebSocket framework for Ruby on Rails.",
"main": "app/assets/javascripts/action_cable.js", "main": "app/assets/javascripts/action_cable.js",
"files": [ "files": [
......
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* Allow skipping incineration of processed emails. * Allow skipping incineration of processed emails.
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* No changes. * No changes.
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* Make debug exceptions works in an environment where ActiveStorage is not loaded. * Make debug exceptions works in an environment where ActiveStorage is not loaded.
......
...@@ -79,6 +79,11 @@ def formats ...@@ -79,6 +79,11 @@ def formats
else else
[Mime[:html]] [Mime[:html]]
end end
v = v.select do |format|
format.symbol || format.ref == "*/*"
end
set_header k, v set_header k, v
end end
end end
......
...@@ -24,9 +24,10 @@ module Session ...@@ -24,9 +24,10 @@ module Session
# #
# Rails.application.config.session_store :cookie_store, key: '_your_app_session' # Rails.application.config.session_store :cookie_store, key: '_your_app_session'
# #
# By default, your secret key base is derived from your application name in # In the development and test environments your application's secret key base is
# the test and development environments. In all other environments, it is stored # generated by Rails and stored in a temporary file in <tt>tmp/development_secret.txt</tt>.
# encrypted in the <tt>config/credentials.yml.enc</tt> file. # In all other environments, it is stored encrypted in the
# <tt>config/credentials.yml.enc</tt> file.
# #
# If your application was not updated to Rails 5.2 defaults, the secret_key_base # If your application was not updated to Rails 5.2 defaults, the secret_key_base
# will be found in the old <tt>config/secrets.yml</tt> file. # will be found in the old <tt>config/secrets.yml</tt> file.
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
...@@ -125,7 +125,7 @@ def using_non_conflicting_nested_js_then_js ...@@ -125,7 +125,7 @@ def using_non_conflicting_nested_js_then_js
def custom_type_handling def custom_type_handling
respond_to do |type| respond_to do |type|
type.html { render body: "HTML" } type.html { render body: "HTML" }
type.custom("application/crazy-xml") { render body: "Crazy XML" } type.custom("application/fancy-xml") { render body: "Fancy XML" }
type.all { render body: "Nothing" } type.all { render body: "Nothing" }
end end
end end
...@@ -314,12 +314,14 @@ def setup ...@@ -314,12 +314,14 @@ def setup
@request.host = "www.example.com" @request.host = "www.example.com"
Mime::Type.register_alias("text/html", :iphone) Mime::Type.register_alias("text/html", :iphone)
Mime::Type.register("text/x-mobile", :mobile) Mime::Type.register("text/x-mobile", :mobile)
Mime::Type.register("application/fancy-xml", :fancy_xml)
end end
def teardown def teardown
super super
Mime::Type.unregister(:iphone) Mime::Type.unregister(:iphone)
Mime::Type.unregister(:mobile) Mime::Type.unregister(:mobile)
Mime::Type.unregister(:fancy_xml)
end end
def test_html def test_html
...@@ -489,10 +491,10 @@ def test_synonyms ...@@ -489,10 +491,10 @@ def test_synonyms
end end
def test_custom_types def test_custom_types
@request.accept = "application/crazy-xml" @request.accept = "application/fancy-xml"
get :custom_type_handling get :custom_type_handling
assert_equal "application/crazy-xml", @response.content_type assert_equal "application/fancy-xml", @response.content_type
assert_equal "Crazy XML", @response.body assert_equal "Fancy XML", @response.body
@request.accept = "text/html" @request.accept = "text/html"
get :custom_type_handling get :custom_type_handling
......
...@@ -20,9 +20,19 @@ class TestContentNegotiation < Rack::TestCase ...@@ -20,9 +20,19 @@ class TestContentNegotiation < Rack::TestCase
assert_body "Hello world */*!" assert_body "Hello world */*!"
end end
test "Not all mimes are converted to symbol" do test "A js or */* Accept header will return HTML" do
get "/content_negotiation/basic/hello", headers: { "HTTP_ACCEPT" => "text/javascript, */*" }
assert_body "Hello world text/html!"
end
test "A js or */* Accept header on xhr will return HTML" do
get "/content_negotiation/basic/hello", headers: { "HTTP_ACCEPT" => "text/javascript, */*" }, xhr: true
assert_body "Hello world text/javascript!"
end
test "Unregistered mimes are ignored" do
get "/content_negotiation/basic/all", headers: { "HTTP_ACCEPT" => "text/plain, mime/another" } get "/content_negotiation/basic/all", headers: { "HTTP_ACCEPT" => "text/plain, mime/another" }
assert_body '[:text, "mime/another"]' assert_body '[:text]'
end end
end end
end end
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* No changes. * No changes.
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
{ {
"name": "@rails/actiontext", "name": "@rails/actiontext",
"version": "6.0.0-beta2", "version": "6.0.0-beta3",
"description": "Edit and display rich text in Rails applications", "description": "Edit and display rich text in Rails applications",
"main": "app/javascript/actiontext/index.js", "main": "app/javascript/actiontext/index.js",
"files": [ "files": [
......
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* ActionView::Template.finalize_compiled_template_methods is deprecated with * ActionView::Template.finalize_compiled_template_methods is deprecated with
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
{ {
"name": "@rails/ujs", "name": "@rails/ujs",
"version": "6.0.0-beta2", "version": "6.0.0-beta3",
"description": "Ruby on Rails unobtrusive scripting adapter", "description": "Ruby on Rails unobtrusive scripting adapter",
"main": "lib/assets/compiled/rails-ujs.js", "main": "lib/assets/compiled/rails-ujs.js",
"files": [ "files": [
......
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* No changes. * No changes.
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
* Change how validation error translation strings are fetched: The new behavior * Change how validation error translation strings are fetched: The new behavior
will first try the more specific keys, including doing locale fallback, then try will first try the more specific keys, including doing locale fallback, then try
the less specific ones. the less specific ones.
For example, this is the order in which keys will now be tried for a `blank` For example, this is the order in which keys will now be tried for a `blank`
error on a `product`'s `title` attribute with current locale set to `en-US`: error on a `product`'s `title` attribute with current locale set to `en-US`:
en-US.activerecord.errors.models.product.attributes.title.blank en-US.activerecord.errors.models.product.attributes.title.blank
en-US.activerecord.errors.models.product.blank en-US.activerecord.errors.models.product.blank
en-US.activerecord.errors.messages.blank en-US.activerecord.errors.messages.blank
en.activerecord.errors.models.product.attributes.title.blank en.activerecord.errors.models.product.attributes.title.blank
en.activerecord.errors.models.product.blank en.activerecord.errors.models.product.blank
en.activerecord.errors.messages.blank en.activerecord.errors.messages.blank
en-US.errors.attributes.title.blank en-US.errors.attributes.title.blank
en-US.errors.messages.blank en-US.errors.messages.blank
en.errors.attributes.title.blank en.errors.attributes.title.blank
en.errors.messages.blank en.errors.messages.blank
*Hugo Vacher* *Hugo Vacher*
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* Fix date value when casting a multiparameter date hash to not convert * Fix date value when casting a multiparameter date hash to not convert
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
...@@ -70,6 +70,11 @@ ...@@ -70,6 +70,11 @@
*Juani Villarejo* *Juani Villarejo*
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* Fix prepared statements caching to be enabled even when query caching is enabled. * Fix prepared statements caching to be enabled even when query caching is enabled.
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* No changes. * No changes.
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
{ {
"name": "@rails/activestorage", "name": "@rails/activestorage",
"version": "6.0.0-beta2", "version": "6.0.0-beta3",
"description": "Attach cloud and local files in Rails applications", "description": "Attach cloud and local files in Rails applications",
"main": "app/assets/javascripts/activestorage.js", "main": "app/assets/javascripts/activestorage.js",
"files": [ "files": [
......
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
*DHH* *DHH*
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk). * New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* No changes. * No changes.
......
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.
## Rails 6.0.0.beta2 (February 25, 2019) ## ## Rails 6.0.0.beta2 (February 25, 2019) ##
* Fix non-symbol access to nested hashes returned from `Rails::Application.config_for` * Fix non-symbol access to nested hashes returned from `Rails::Application.config_for`
......
...@@ -415,8 +415,8 @@ def secrets ...@@ -415,8 +415,8 @@ def secrets
# then credentials.secret_key_base, and finally secrets.secret_key_base. For most applications, # then credentials.secret_key_base, and finally secrets.secret_key_base. For most applications,
# the correct place to store it is in the encrypted credentials file. # the correct place to store it is in the encrypted credentials file.
def secret_key_base def secret_key_base
if Rails.env.test? || Rails.env.development? if Rails.env.development? || Rails.env.test?
secrets.secret_key_base || Digest::MD5.hexdigest(self.class.name) secrets.secret_key_base ||= generate_development_secret
else else
validate_secret_key_base( validate_secret_key_base(
ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || secrets.secret_key_base ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || secrets.secret_key_base
...@@ -581,6 +581,21 @@ def validate_secret_key_base(secret_key_base) ...@@ -581,6 +581,21 @@ def validate_secret_key_base(secret_key_base)
private private
def generate_development_secret
if secrets.secret_key_base.nil?
key_file = Rails.root.join("tmp/development_secret.txt")
if !File.exist?(key_file)
random_key = SecureRandom.hex(64)
File.binwrite(key_file, random_key)
end
secrets.secret_key_base = File.binread(key_file)
end
secrets.secret_key_base
end
def build_request(env) def build_request(env)
req = super req = super
env["ORIGINAL_FULLPATH"] = req.fullpath env["ORIGINAL_FULLPATH"] = req.fullpath
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
...@@ -596,6 +596,27 @@ def index ...@@ -596,6 +596,27 @@ def index
assert_equal "some_value", verifier.verify(message) assert_equal "some_value", verifier.verify(message)
end end
test "application will generate secret_key_base in tmp file if blank in development" do
app_file "config/initializers/secret_token.rb", <<-RUBY
Rails.application.credentials.secret_key_base = nil
RUBY
app "development"
assert_not_nil app.secrets.secret_key_base
assert File.exist?(app_path("tmp/development_secret.txt"))
end
test "application will not generate secret_key_base in tmp file if blank in production" do
app_file "config/initializers/secret_token.rb", <<-RUBY
Rails.application.credentials.secret_key_base = nil
RUBY
assert_raises ArgumentError do
app "production"
end
end
test "raises when secret_key_base is blank" do test "raises when secret_key_base is blank" do
app_file "config/initializers/secret_token.rb", <<-RUBY app_file "config/initializers/secret_token.rb", <<-RUBY
Rails.application.credentials.secret_key_base = nil Rails.application.credentials.secret_key_base = nil
...@@ -619,7 +640,6 @@ def index ...@@ -619,7 +640,6 @@ def index
test "application verifier can build different verifiers" do test "application verifier can build different verifiers" do
make_basic_app do |application| make_basic_app do |application|
application.credentials.secret_key_base = "b3c631c314c0bbca50c1b2843150fe33"
application.config.session_store :disabled application.config.session_store :disabled
end end
......
...@@ -226,6 +226,7 @@ def self.name; "RailtiesTestApp"; end ...@@ -226,6 +226,7 @@ def self.name; "RailtiesTestApp"; end
@app.config.session_store :cookie_store, key: "_myapp_session" @app.config.session_store :cookie_store, key: "_myapp_session"
@app.config.active_support.deprecation = :log @app.config.active_support.deprecation = :log
@app.config.log_level = :info @app.config.log_level = :info
@app.secrets.secret_key_base = "b3c631c314c0bbca50c1b2843150fe33"
yield @app if block_given? yield @app if block_given?
@app.initialize! @app.initialize!
......
...@@ -10,7 +10,7 @@ module VERSION ...@@ -10,7 +10,7 @@ module VERSION
MAJOR = 6 MAJOR = 6
MINOR = 0 MINOR = 0
TINY = 0 TINY = 0
PRE = "beta2" PRE = "beta3"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册