aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile10
-rw-r--r--Gemfile.lock69
-rw-r--r--actioncable/lib/action_cable/channel/base.rb3
-rw-r--r--actioncable/lib/action_cable/connection/base.rb4
-rw-r--r--actioncable/lib/action_cable/connection/message_buffer.rb3
-rw-r--r--actioncable/lib/action_cable/connection/subscriptions.rb3
-rw-r--r--actioncable/lib/action_cable/connection/tagged_logger_proxy.rb4
-rw-r--r--actioncable/lib/action_cable/connection/web_socket.rb2
-rw-r--r--actioncable/lib/action_cable/process/logging.rb2
-rw-r--r--actioncable/lib/action_cable/server/configuration.rb8
-rw-r--r--actioncable/lib/rails/generators/channel/templates/assets/channel.coffee3
-rw-r--r--actioncable/test/channel/stream_test.rb2
-rw-r--r--actioncable/test/connection/cross_site_forgery_test.rb2
-rw-r--r--actionmailer/lib/rails/generators/mailer/mailer_generator.rb3
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb20
-rw-r--r--actionpack/test/controller/parameters/parameters_permit_test.rb28
-rw-r--r--activejob/activejob.gemspec2
-rw-r--r--activerecord/CHANGELOG.md5
-rw-r--r--activerecord/activerecord.gemspec2
-rw-r--r--activerecord/lib/active_record/associations.rb3
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb3
-rw-r--r--activerecord/lib/active_record/model_schema.rb2
-rw-r--r--activerecord/test/cases/adapters/postgresql/geometric_test.rb8
-rw-r--r--activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb4
-rw-r--r--railties/lib/rails/generators/app_base.rb2
-rw-r--r--railties/lib/rails/generators/erb/mailer/mailer_generator.rb7
-rw-r--r--railties/lib/rails/generators/erb/mailer/templates/layout.html.erb5
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb10
-rw-r--r--railties/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb (renamed from actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb)2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt13
-rw-r--r--railties/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.text.erb.tt (renamed from railties/lib/rails/generators/erb/mailer/templates/layout.text.erb)0
-rw-r--r--railties/test/application/assets_test.rb2
-rw-r--r--railties/test/application/configuration_test.rb1
-rw-r--r--railties/test/application/rake_test.rb2
-rw-r--r--railties/test/generators/app_generator_test.rb1
-rw-r--r--railties/test/generators/mailer_generator_test.rb23
-rw-r--r--railties/test/generators/shared_generator_tests.rb3
37 files changed, 124 insertions, 142 deletions
diff --git a/Gemfile b/Gemfile
index 27a034f11e..9ab6cddbeb 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,8 +5,7 @@ gemspec
# We need a newish Rake since Active Job sets its test tasks' descriptions.
gem 'rake', '>= 10.3'
-# Active Job depends on URI::GID::MissingModelIDError, which isn't released yet.
-gem 'globalid', github: 'rails/globalid', branch: 'master'
+# We need unreleased Rack 2.0.0.alpha
gem 'rack', github: 'rack/rack', branch: 'master'
# This needs to be with require false to ensure correct loading order, as has to
@@ -14,13 +13,8 @@ gem 'rack', github: 'rack/rack', branch: 'master'
gem 'mocha', '~> 0.14', require: false
gem 'rack-cache', '~> 1.2'
-gem 'jquery-rails', github: 'rails/jquery-rails', branch: 'master'
gem 'coffee-rails', '~> 4.1.0'
gem 'turbolinks'
-gem 'arel', github: 'rails/arel', branch: 'master'
-gem 'mail', github: 'mikel/mail', branch: 'master'
-
-gem 'sprockets-rails', '~> 3.0.0.beta3', github: 'rails/sprockets-rails', branch: 'master'
# require: false so bcrypt is loaded only when has_secure_password is used.
# This is to avoid Active Model (and by extension the entire framework)
@@ -90,7 +84,7 @@ group :test do
end
platforms :ruby, :mswin, :mswin64, :mingw, :x64_mingw do
- gem 'nokogiri', '>= 1.6.7'
+ gem 'nokogiri', '>= 1.6.7.1'
# Needed for compiling the ActionDispatch::Journey parser.
gem 'racc', '>=1.4.6', require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index a49496ecb0..ad75b2c9c6 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -20,14 +20,6 @@ GIT
redis-namespace
GIT
- remote: git://github.com/mikel/mail.git
- revision: f0efbd4850d1bc06cdcba6178c282eeaba9c8c43
- branch: master
- specs:
- mail (2.6.3.edge)
- mime-types (>= 1.16, < 3)
-
-GIT
remote: git://github.com/rack/rack.git
revision: 96ae9b9fed8d6809383b6f48a5884437e76f8ca4
branch: master
@@ -36,41 +28,6 @@ GIT
json
GIT
- remote: git://github.com/rails/arel.git
- revision: 899e8428c50c586e6c8d4884b542ac9fdf01e95f
- branch: master
- specs:
- arel (7.0.0.alpha)
-
-GIT
- remote: git://github.com/rails/globalid.git
- revision: 4e74ec6bb60d735ef3c56080f9c9f1dee9cadaaf
- branch: master
- specs:
- globalid (0.3.6)
- activesupport (>= 4.1.0)
-
-GIT
- remote: git://github.com/rails/jquery-rails.git
- revision: 04fcfa29b859eef9479f89b6a799d00212902385
- branch: master
- specs:
- jquery-rails (4.0.5)
- rails-dom-testing (~> 1.0)
- railties (>= 4.2.0)
- thor (>= 0.14, < 2.0)
-
-GIT
- remote: git://github.com/rails/sprockets-rails.git
- revision: 06d84e952490d7d391592124f6e3b79f9c596674
- branch: master
- specs:
- sprockets-rails (3.0.0.beta3)
- actionpack (>= 4.0)
- activesupport (>= 4.0)
- sprockets (>= 3.0.0)
-
-GIT
remote: git://github.com/sass/sass.git
revision: bce9509f396225d721501ea1070a6871b708abb1
branch: stable
@@ -109,14 +66,14 @@ PATH
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (5.0.0.alpha)
activesupport (= 5.0.0.alpha)
- globalid (>= 0.3.0)
+ globalid (>= 0.3.6)
activemodel (5.0.0.alpha)
activesupport (= 5.0.0.alpha)
builder (~> 3.1)
activerecord (5.0.0.alpha)
activemodel (= 5.0.0.alpha)
activesupport (= 5.0.0.alpha)
- arel (= 7.0.0.alpha)
+ arel (~> 7.0)
activesupport (5.0.0.alpha)
concurrent-ruby (~> 1.0)
i18n (~> 0.7)
@@ -147,6 +104,7 @@ GEM
remote: https://rubygems.org/
specs:
amq-protocol (2.0.0)
+ arel (7.0.0)
backburner (1.2.0)
beaneater (~> 1.0)
dante (> 0.1.5)
@@ -204,6 +162,8 @@ GEM
ffi (1.9.10)
ffi (1.9.10-x64-mingw32)
ffi (1.9.10-x86-mingw32)
+ globalid (0.3.6)
+ activesupport (>= 4.1.0)
hiredis (0.5.2)
hitimes (1.2.3)
hitimes (1.2.3-x86-mingw32)
@@ -217,6 +177,8 @@ GEM
rb-inotify (>= 0.9)
loofah (2.0.3)
nokogiri (>= 1.5.9)
+ mail (2.6.3)
+ mime-types (>= 1.16, < 3)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (2.99)
@@ -230,11 +192,11 @@ GEM
mysql2 (0.4.2)
mysql2 (0.4.2-x64-mingw32)
mysql2 (0.4.2-x86-mingw32)
- nokogiri (1.6.7)
+ nokogiri (1.6.7.1)
mini_portile2 (~> 2.0.0.rc2)
- nokogiri (1.6.7-x64-mingw32)
+ nokogiri (1.6.7.1-x64-mingw32)
mini_portile2 (~> 2.0.0.rc2)
- nokogiri (1.6.7-x86-mingw32)
+ nokogiri (1.6.7.1-x86-mingw32)
mini_portile2 (~> 2.0.0.rc2)
pg (0.18.4)
pg (0.18.4-x64-mingw32)
@@ -298,6 +260,10 @@ GEM
sprockets (3.5.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
+ sprockets-rails (3.0.0)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
sqlite3 (1.3.11)
sqlite3 (1.3.11-x64-mingw32)
sqlite3 (1.3.11-x86-mingw32)
@@ -336,7 +302,6 @@ DEPENDENCIES
activerecord-jdbcmysql-adapter (>= 1.3.0)
activerecord-jdbcpostgresql-adapter (>= 1.3.0)
activerecord-jdbcsqlite3-adapter (>= 1.3.0)
- arel!
backburner
bcrypt (~> 3.1.10)
bcrypt-ruby (~> 3.0.0)
@@ -346,16 +311,13 @@ DEPENDENCIES
dalli (>= 2.2.1)
delayed_job
delayed_job_active_record
- globalid!
- jquery-rails!
json
kindlerb (= 0.1.1)
listen (~> 3.0.5)
- mail!
minitest (< 5.3.4)
mocha (~> 0.14)
mysql2 (>= 0.4.0)
- nokogiri (>= 1.6.7)
+ nokogiri (>= 1.6.7.1)
pg (>= 0.18.0)
psych (~> 2.0)
puma
@@ -376,7 +338,6 @@ DEPENDENCIES
sequel
sidekiq
sneakers
- sprockets-rails (~> 3.0.0.beta3)!
sqlite3 (~> 1.3.6)
stackprof
sucker_punch
diff --git a/actioncable/lib/action_cable/channel/base.rb b/actioncable/lib/action_cable/channel/base.rb
index ca903a810d..f3085840ca 100644
--- a/actioncable/lib/action_cable/channel/base.rb
+++ b/actioncable/lib/action_cable/channel/base.rb
@@ -137,6 +137,9 @@ module ActionCable
# transmission until redis pubsub subscription is confirmed.
@defer_subscription_confirmation = false
+ @reject_subscription = nil
+ @subscription_confirmation_sent = nil
+
delegate_connection_identifiers
subscribe_to_channel
end
diff --git a/actioncable/lib/action_cable/connection/base.rb b/actioncable/lib/action_cable/connection/base.rb
index 7e9eec7508..f7b18a85ae 100644
--- a/actioncable/lib/action_cable/connection/base.rb
+++ b/actioncable/lib/action_cable/connection/base.rb
@@ -62,6 +62,7 @@ module ActionCable
@subscriptions = ActionCable::Connection::Subscriptions.new(self)
@message_buffer = ActionCable::Connection::MessageBuffer.new(self)
+ @_internal_redis_subscriptions = nil
@started_at = Time.now
end
@@ -138,10 +139,11 @@ module ActionCable
end
- private
+ protected
attr_reader :websocket
attr_reader :message_buffer
+ private
def on_open
connect if respond_to?(:connect)
subscribe_to_internal_channel
diff --git a/actioncable/lib/action_cable/connection/message_buffer.rb b/actioncable/lib/action_cable/connection/message_buffer.rb
index 25cff75b41..2f65a1e84a 100644
--- a/actioncable/lib/action_cable/connection/message_buffer.rb
+++ b/actioncable/lib/action_cable/connection/message_buffer.rb
@@ -29,10 +29,11 @@ module ActionCable
receive_buffered_messages
end
- private
+ protected
attr_reader :connection
attr_accessor :buffered_messages
+ private
def valid?(message)
message.is_a?(String)
end
diff --git a/actioncable/lib/action_cable/connection/subscriptions.rb b/actioncable/lib/action_cable/connection/subscriptions.rb
index 6199db4898..65d6634bb0 100644
--- a/actioncable/lib/action_cable/connection/subscriptions.rb
+++ b/actioncable/lib/action_cable/connection/subscriptions.rb
@@ -58,9 +58,10 @@ module ActionCable
subscriptions.each { |id, channel| channel.unsubscribe_from_channel }
end
+ protected
+ attr_reader :connection, :subscriptions
private
- attr_reader :connection, :subscriptions
delegate :logger, to: :connection
def find(data)
diff --git a/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb b/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb
index e5319087fb..41afa9680a 100644
--- a/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb
+++ b/actioncable/lib/action_cable/connection/tagged_logger_proxy.rb
@@ -1,7 +1,7 @@
module ActionCable
module Connection
- # Allows the use of per-connection tags against the server logger. This wouldn't work using the tradional
- # ActiveSupport::TaggedLogging-enhanced Rails.logger, as that logger will reset the tags between requests.
+ # Allows the use of per-connection tags against the server logger. This wouldn't work using the traditional
+ # <tt>ActiveSupport::TaggedLogging</tt> enhanced Rails.logger, as that logger will reset the tags between requests.
# The connection is long-lived, so it needs its own set of tags for its independent duration.
class TaggedLoggerProxy
attr_reader :tags
diff --git a/actioncable/lib/action_cable/connection/web_socket.rb b/actioncable/lib/action_cable/connection/web_socket.rb
index 169b683b8c..670d5690ae 100644
--- a/actioncable/lib/action_cable/connection/web_socket.rb
+++ b/actioncable/lib/action_cable/connection/web_socket.rb
@@ -22,7 +22,7 @@ module ActionCable
websocket.send data
end
- private
+ protected
attr_reader :websocket
end
end
diff --git a/actioncable/lib/action_cable/process/logging.rb b/actioncable/lib/action_cable/process/logging.rb
index 618ba7357a..72b1a080d1 100644
--- a/actioncable/lib/action_cable/process/logging.rb
+++ b/actioncable/lib/action_cable/process/logging.rb
@@ -8,5 +8,3 @@ EM.error_handler do |e|
end
Celluloid.logger = ActionCable.server.logger
-
-ActionCable.server.config.log_to_stdout if Rails.env.development? \ No newline at end of file
diff --git a/actioncable/lib/action_cable/server/configuration.rb b/actioncable/lib/action_cable/server/configuration.rb
index 5d65f5e0e9..935133cbba 100644
--- a/actioncable/lib/action_cable/server/configuration.rb
+++ b/actioncable/lib/action_cable/server/configuration.rb
@@ -20,14 +20,6 @@ module ActionCable
@disable_request_forgery_protection = false
end
- def log_to_stdout
- console = ActiveSupport::Logger.new($stdout)
- console.formatter = @logger.formatter
- console.level = @logger.level
-
- @logger.extend(ActiveSupport::Logger.broadcast(console))
- end
-
def channel_paths
@channels ||= Dir["#{channels_path}/**/*_channel.rb"]
end
diff --git a/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee b/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee
index 69f945ca3f..149821f1ea 100644
--- a/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee
+++ b/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee
@@ -5,6 +5,9 @@ App.<%= class_name.underscore %> = App.cable.subscriptions.create "<%= class_nam
disconnected: ->
# Called when the subscription has been terminated by the server
+ received: (data) ->
+ # Called when there's incoming data on the websocket for this channel
+
<% actions.each do |action| -%>
<%= action %>: ->
@perform '<%= action %>'
diff --git a/actioncable/test/channel/stream_test.rb b/actioncable/test/channel/stream_test.rb
index 5e4e01abbf..1424ded04c 100644
--- a/actioncable/test/channel/stream_test.rb
+++ b/actioncable/test/channel/stream_test.rb
@@ -45,7 +45,7 @@ class ActionCable::Channel::StreamTest < ActionCable::TestCase
connection = TestConnection.new
connection.expects(:pubsub).returns EM::Hiredis.connect.pubsub
- channel = ChatChannel.new connection, "{id: 1}", { id: 1 }
+ ChatChannel.new connection, "{id: 1}", { id: 1 }
assert_nil connection.last_transmission
EM::Timer.new(0.1) do
diff --git a/actioncable/test/connection/cross_site_forgery_test.rb b/actioncable/test/connection/cross_site_forgery_test.rb
index ede3057e30..d445e08f2a 100644
--- a/actioncable/test/connection/cross_site_forgery_test.rb
+++ b/actioncable/test/connection/cross_site_forgery_test.rb
@@ -57,7 +57,7 @@ class ActionCable::Connection::CrossSiteForgeryTest < ActionCable::TestCase
private
def assert_origin_allowed(origin)
response = connect_with_origin origin
- assert_equal -1, response[0]
+ assert_equal(-1, response[0])
end
def assert_origin_not_allowed(origin)
diff --git a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
index 3ec7d3d896..5a5c9d32bb 100644
--- a/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
+++ b/actionmailer/lib/rails/generators/mailer/mailer_generator.rb
@@ -9,9 +9,6 @@ module Rails
def create_mailer_file
template "mailer.rb", File.join('app/mailers', class_path, "#{file_name}_mailer.rb")
- if self.behavior == :invoke
- template "application_mailer.rb", 'app/mailers/application_mailer.rb'
- end
end
hook_for :template_engine, :test_framework
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index 8bc3c271e2..957aa746c0 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -1,4 +1,5 @@
require 'active_support/core_ext/hash/indifferent_access'
+require 'active_support/core_ext/hash/transform_values'
require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/string/filters'
require 'active_support/rescuable'
@@ -175,7 +176,7 @@ module ActionController
# safe_params.to_h # => {"name"=>"Senjougahara Hitagi"}
def to_h
if permitted?
- @parameters.deep_dup
+ convert_parameters_to_hashes(@parameters)
else
slice(*self.class.always_permitted_parameters).permit!.to_h
end
@@ -185,7 +186,7 @@ module ActionController
# <tt>ActiveSupport::HashWithIndifferentAccess</tt> representation of this
# parameter.
def to_unsafe_h
- @parameters.deep_dup
+ convert_parameters_to_hashes(@parameters)
end
alias_method :to_unsafe_hash, :to_unsafe_h
@@ -594,6 +595,21 @@ module ActionController
end
end
+ def convert_parameters_to_hashes(value)
+ case value
+ when Array
+ value.map { |v| convert_parameters_to_hashes(v) }
+ when Hash
+ value.transform_values do |v|
+ convert_parameters_to_hashes(v)
+ end.with_indifferent_access
+ when Parameters
+ value.to_h
+ else
+ value
+ end
+ end
+
def convert_hashes_to_parameters(key, value)
converted = convert_value_to_parameters(value)
@parameters[key] = converted unless converted.equal?(value)
diff --git a/actionpack/test/controller/parameters/parameters_permit_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb
index 87816515e7..f23aa599c1 100644
--- a/actionpack/test/controller/parameters/parameters_permit_test.rb
+++ b/actionpack/test/controller/parameters/parameters_permit_test.rb
@@ -297,4 +297,32 @@ class ParametersPermitTest < ActiveSupport::TestCase
assert @params.to_h.is_a? ActiveSupport::HashWithIndifferentAccess
assert_not @params.to_h.is_a? ActionController::Parameters
end
+
+ test "to_h only deep dups Ruby collections" do
+ company = Class.new do
+ attr_reader :dupped
+ def dup; @dupped = true; end
+ end.new
+
+ params = ActionController::Parameters.new(prem: { likes: %i( dancing ) })
+ assert_equal({ 'prem' => { 'likes' => %i( dancing ) } }, params.permit!.to_h)
+
+ params = ActionController::Parameters.new(companies: [ company, :acme ])
+ assert_equal({ 'companies' => [ company, :acme ] }, params.permit!.to_h)
+ assert_not company.dupped
+ end
+
+ test "to_unsafe_h only deep dups Ruby collections" do
+ company = Class.new do
+ attr_reader :dupped
+ def dup; @dupped = true; end
+ end.new
+
+ params = ActionController::Parameters.new(prem: { likes: %i( dancing ) })
+ assert_equal({ 'prem' => { 'likes' => %i( dancing ) } }, params.to_unsafe_h)
+
+ params = ActionController::Parameters.new(companies: [ company, :acme ])
+ assert_equal({ 'companies' => [ company, :acme ] }, params.to_unsafe_h)
+ assert_not company.dupped
+ end
end
diff --git a/activejob/activejob.gemspec b/activejob/activejob.gemspec
index 24e38e495f..bc1671b508 100644
--- a/activejob/activejob.gemspec
+++ b/activejob/activejob.gemspec
@@ -19,5 +19,5 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.add_dependency 'activesupport', version
- s.add_dependency 'globalid', '>= 0.3.0'
+ s.add_dependency 'globalid', '>= 0.3.6'
end
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index af761bc7b3..5f4c426435 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,8 @@
+* Extract support for the legacy `mysql` database adapter from core. It will
+ live on in a separate gem for now, but most users should just use `mysql2`.
+
+ *Abdelkader Boudih*
+
* ApplicationRecord is a new superclass for all app models, analogous to app
controllers subclassing ApplicationController instead of
ActionController::Base. This gives apps a single spot to configure app-wide
diff --git a/activerecord/activerecord.gemspec b/activerecord/activerecord.gemspec
index bd95b57303..4405da2812 100644
--- a/activerecord/activerecord.gemspec
+++ b/activerecord/activerecord.gemspec
@@ -24,5 +24,5 @@ Gem::Specification.new do |s|
s.add_dependency 'activesupport', version
s.add_dependency 'activemodel', version
- s.add_dependency 'arel', '7.0.0.alpha'
+ s.add_dependency 'arel', '~> 7.0'
end
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 04ad45f5da..462b3066ab 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1181,7 +1181,8 @@ module ActiveRecord
# [collection=objects]
# Replaces the collections content by deleting and adding objects as appropriate. If the <tt>:through</tt>
# option is true callbacks in the join models are triggered except destroy callbacks, since deletion is
- # direct.
+ # direct by default. You can specify <tt>dependent: :destroy</tt> or
+ # <tt>dependent: :nullify</tt> to override this.
# [collection_singular_ids]
# Returns an array of the associated objects' ids
# [collection_singular_ids=ids]
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index aa43854d01..a1ec570042 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -816,9 +816,8 @@ module ActiveRecord
ActiveRecord::Type.register(:json, OID::Json, adapter: :postgresql)
ActiveRecord::Type.register(:jsonb, OID::Jsonb, adapter: :postgresql)
ActiveRecord::Type.register(:money, OID::Money, adapter: :postgresql)
- ActiveRecord::Type.register(:point, OID::Point, adapter: :postgresql)
+ ActiveRecord::Type.register(:point, OID::Rails51Point, adapter: :postgresql)
ActiveRecord::Type.register(:legacy_point, OID::Point, adapter: :postgresql)
- ActiveRecord::Type.register(:rails_5_1_point, OID::Rails51Point, adapter: :postgresql)
ActiveRecord::Type.register(:uuid, OID::Uuid, adapter: :postgresql)
ActiveRecord::Type.register(:vector, OID::Vector, adapter: :postgresql)
ActiveRecord::Type.register(:xml, OID::Xml, adapter: :postgresql)
diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb
index 5df67cdbe7..a6a68f3d4b 100644
--- a/activerecord/lib/active_record/model_schema.rb
+++ b/activerecord/lib/active_record/model_schema.rb
@@ -385,7 +385,7 @@ module ActiveRecord
If you'd like the new behavior today, you can add this line:
- attribute :#{column.name}, :rails_5_1_point#{array_arguments}
+ attribute :#{column.name}, :point#{array_arguments}
WARNING
end
end
diff --git a/activerecord/test/cases/adapters/postgresql/geometric_test.rb b/activerecord/test/cases/adapters/postgresql/geometric_test.rb
index 3b97cb4ad4..9e250c2b7c 100644
--- a/activerecord/test/cases/adapters/postgresql/geometric_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/geometric_test.rb
@@ -7,10 +7,10 @@ class PostgresqlPointTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class PostgresqlPoint < ActiveRecord::Base
- attribute :x, :rails_5_1_point
- attribute :y, :rails_5_1_point
- attribute :z, :rails_5_1_point
- attribute :array_of_points, :rails_5_1_point, array: true
+ attribute :x, :point
+ attribute :y, :point
+ attribute :z, :point
+ attribute :array_of_points, :point, array: true
attribute :legacy_x, :legacy_point
attribute :legacy_y, :legacy_point
attribute :legacy_z, :legacy_point
diff --git a/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb b/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb
index d2d89ec2d7..e02e965d75 100644
--- a/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb
+++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb
@@ -15,7 +15,7 @@ class Module
# end
#
# Current.user # => nil
- # Thread.thread_variable_set("attr_Current_user", "DHH")
+ # Thread.current.thread_variable_set("attr_Current_user", "DHH")
# Current.user # => "DHH"
#
# The attribute name must be a valid method name in Ruby.
@@ -63,7 +63,7 @@ class Module
# end
#
# Current.user = "DHH"
- # Thread.thread_variable_get("attr_Current_user") # => "DHH"
+ # Thread.current.thread_variable_get("attr_Current_user") # => "DHH"
#
# If you want to opt out the instance writer method, pass
# <tt>instance_writer: false</tt> or <tt>instance_accessor: false</tt>.
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index c4f4d834e1..9036966d42 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -220,8 +220,6 @@ module Rails
def rails_gemfile_entry
dev_edge_common = [
- GemfileEntry.github('sprockets-rails', 'rails/sprockets-rails'),
- GemfileEntry.github('arel', 'rails/arel'),
GemfileEntry.github('rack', 'rack/rack')
]
if options.dev?
diff --git a/railties/lib/rails/generators/erb/mailer/mailer_generator.rb b/railties/lib/rails/generators/erb/mailer/mailer_generator.rb
index 65563aa6db..bc249aa5e5 100644
--- a/railties/lib/rails/generators/erb/mailer/mailer_generator.rb
+++ b/railties/lib/rails/generators/erb/mailer/mailer_generator.rb
@@ -9,13 +9,6 @@ module Erb # :nodoc:
view_base_path = File.join("app/views", class_path, file_name + '_mailer')
empty_directory view_base_path
- if self.behavior == :invoke
- formats.each do |format|
- layout_path = File.join("app/views/layouts", filename_with_extensions("mailer", format))
- template filename_with_extensions(:layout, format), layout_path
- end
- end
-
actions.each do |action|
@action = action
diff --git a/railties/lib/rails/generators/erb/mailer/templates/layout.html.erb b/railties/lib/rails/generators/erb/mailer/templates/layout.html.erb
deleted file mode 100644
index 93110e74ad..0000000000
--- a/railties/lib/rails/generators/erb/mailer/templates/layout.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
- <body>
- <%%= yield %>
- </body>
-</html>
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 2a3f16c02e..44bbc478d0 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -59,8 +59,6 @@ module Rails
keep_file 'app/assets/images'
keep_file 'app/assets/javascripts/channels' unless options[:skip_action_cable]
- keep_file 'app/mailers'
-
keep_file 'app/controllers/concerns'
keep_file 'app/models/concerns'
end
@@ -301,6 +299,14 @@ module Rails
end
end
+ def delete_action_mailer_files_skipping_action_mailer
+ if options[:skip_action_mailer]
+ remove_file 'app/mailers/application_mailer.rb'
+ remove_file 'app/views/layouts/mailer.html.erb'
+ remove_file 'app/views/layouts/mailer.text.erb'
+ end
+ end
+
def delete_active_record_initializers_skipping_active_record
if options[:skip_active_record]
remove_file 'config/initializers/active_record_belongs_to_required_by_default.rb'
diff --git a/actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb b/railties/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb
index d25d8892dd..286b2239d1 100644
--- a/actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb
+++ b/railties/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb
@@ -1,4 +1,4 @@
class ApplicationMailer < ActionMailer::Base
- default from: "from@example.com"
+ default from: 'from@example.com'
layout 'mailer'
end
diff --git a/railties/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt b/railties/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt
new file mode 100644
index 0000000000..55f3675d49
--- /dev/null
+++ b/railties/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <style>
+ /* Email styles need to be inline */
+ </style>
+ </head>
+
+ <body>
+ <%%= yield %>
+ </body>
+</html>
diff --git a/railties/lib/rails/generators/erb/mailer/templates/layout.text.erb b/railties/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.text.erb.tt
index 6363733e6e..6363733e6e 100644
--- a/railties/lib/rails/generators/erb/mailer/templates/layout.text.erb
+++ b/railties/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.text.erb.tt
diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb
index 7e9213ddc1..5f3b364f97 100644
--- a/railties/test/application/assets_test.rb
+++ b/railties/test/application/assets_test.rb
@@ -410,7 +410,7 @@ module ApplicationTests
precompile!
- assert_match /Post;/, File.read(Dir["#{app_path}/public/assets/application-*.js"].first)
+ assert_match(/Post;/, File.read(Dir["#{app_path}/public/assets/application-*.js"].first))
end
test "initialization on the assets group should set assets_dir" do
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index b638ca1614..50d343865c 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -229,6 +229,7 @@ module ApplicationTests
test "the application can be eager loaded even when there are no frameworks" do
FileUtils.rm_rf("#{app_path}/app/models/application_record.rb")
+ FileUtils.rm_rf("#{app_path}/app/mailers/application_mailer.rb")
FileUtils.rm_rf("#{app_path}/config/environments")
add_to_config <<-RUBY
config.eager_load = true
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index 6373c7b42b..c8fb9fbc67 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -98,7 +98,7 @@ module ApplicationTests
end
def test_code_statistics_sanity
- assert_match "Code LOC: 10 Test LOC: 0 Code to Test Ratio: 1:0.0",
+ assert_match "Code LOC: 14 Test LOC: 0 Code to Test Ratio: 1:0.0",
Dir.chdir(app_path){ `bin/rake stats` }
end
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 575c1ed1d9..ddbcd4c394 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -617,7 +617,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
run_generator
folders_with_keep = %w(
app/assets/images
- app/mailers
app/controllers/concerns
app/models/concerns
lib/tasks
diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb
index f01e8cd2d9..f8d9ccacb4 100644
--- a/railties/test/generators/mailer_generator_test.rb
+++ b/railties/test/generators/mailer_generator_test.rb
@@ -14,15 +14,6 @@ class MailerGeneratorTest < Rails::Generators::TestCase
end
end
- def test_application_mailer_skeleton_is_created
- run_generator
- assert_file "app/mailers/application_mailer.rb" do |mailer|
- assert_match(/class ApplicationMailer < ActionMailer::Base/, mailer)
- assert_match(/default from: "from@example.com"/, mailer)
- assert_match(/layout 'mailer'/, mailer)
- end
- end
-
def test_mailer_with_i18n_helper
run_generator
assert_file "app/mailers/notifier_mailer.rb" do |mailer|
@@ -87,10 +78,6 @@ class MailerGeneratorTest < Rails::Generators::TestCase
assert_match(%r(\sapp/views/notifier_mailer/bar\.text\.erb), view)
assert_match(/<%= @greeting %>/, view)
end
-
- assert_file "app/views/layouts/mailer.text.erb" do |view|
- assert_match(/<%= yield %>/, view)
- end
end
def test_invokes_default_html_template_engine
@@ -104,17 +91,11 @@ class MailerGeneratorTest < Rails::Generators::TestCase
assert_match(%r(\sapp/views/notifier_mailer/bar\.html\.erb), view)
assert_match(/<%= @greeting %>/, view)
end
-
- assert_file "app/views/layouts/mailer.html.erb" do |view|
- assert_match(%r{<html>\n <body>\n <%= yield %>\n </body>\n</html>}, view)
- end
end
def test_invokes_default_template_engine_even_with_no_action
run_generator ["notifier"]
assert_file "app/views/notifier_mailer"
- assert_file "app/views/layouts/mailer.text.erb"
- assert_file "app/views/layouts/mailer.html.erb"
end
def test_logs_if_the_template_engine_cannot_be_found
@@ -162,10 +143,6 @@ class MailerGeneratorTest < Rails::Generators::TestCase
assert_no_file "app/views/notifier/bar.text.erb"
assert_no_file "app/views/notifier/foo.html.erb"
assert_no_file "app/views/notifier/bar.html.erb"
-
- assert_file "app/mailers/application_mailer.rb"
- assert_file "app/views/layouts/mailer.text.erb"
- assert_file "app/views/layouts/mailer.html.erb"
end
def test_mailer_suffix_is_not_duplicated
diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb
index acb78ec888..e83d54890a 100644
--- a/railties/test/generators/shared_generator_tests.rb
+++ b/railties/test/generators/shared_generator_tests.rb
@@ -144,7 +144,6 @@ module SharedGeneratorTests
def test_skip_git
run_generator [destination_root, '--skip-git', '--full']
assert_no_file('.gitignore')
- assert_file('app/mailers/.keep')
end
def test_skip_keeps
@@ -154,6 +153,6 @@ module SharedGeneratorTests
assert_no_match(/\.keep/, content)
end
- assert_no_file('app/mailers/.keep')
+ assert_no_file('app/models/concerns/.keep')
end
end