aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionview/lib/action_view/helpers/form_helper.rb6
-rw-r--r--activemodel/lib/active_model/errors.rb1
-rw-r--r--activerecord/CHANGELOG.md6
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb2
-rw-r--r--activerecord/test/cases/schema_dumper_test.rb5
-rw-r--r--activerecord/test/schema/postgresql_specific_schema.rb4
-rw-r--r--railties/lib/rails/tasks/initializers.rake2
-rw-r--r--railties/lib/rails/test_unit/runner.rb7
8 files changed, 24 insertions, 9 deletions
diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb
index 63bb4ce32f..f2a74ea647 100644
--- a/actionview/lib/action_view/helpers/form_helper.rb
+++ b/actionview/lib/action_view/helpers/form_helper.rb
@@ -67,10 +67,10 @@ module ActionView
#
# In particular, thanks to the conventions followed in the generated field names, the
# controller gets a nested hash <tt>params[:person]</tt> with the person attributes
- # set in the form. That hash is ready to be passed to <tt>Person.create</tt>:
+ # set in the form. That hash is ready to be passed to <tt>Person.new</tt>:
#
- # @person = Person.create(params[:person])
- # if @person.valid?
+ # @person = Person.new(params[:person])
+ # if @person.save
# # success
# else
# # error handling
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index f324788979..cbca76d949 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -3,6 +3,7 @@
require 'active_support/core_ext/array/conversions'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/object/deep_dup'
+require 'active_support/core_ext/string/filters'
module ActiveModel
# == Active \Model \Errors
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 82d7ab353d..8b35839a50 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -698,4 +698,10 @@
*Yves Senn*
+* Fixes #19420. When generating schema.rb using Postgres BigInt[] data type
+ the limit: 8 was not coming through. This caused it to become Int[] data type
+ after doing a rebuild off of schema.rb.
+
+ *Jake Waller*
+
Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/activerecord/CHANGELOG.md) for previous changes.
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb
index fb4e0de2a8..f486c5ecb7 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb
@@ -18,7 +18,7 @@ module ActiveRecord
end
attr_reader :subtype, :delimiter
- delegate :type, :user_input_in_time_zone, to: :subtype
+ delegate :type, :user_input_in_time_zone, :limit, to: :subtype
def initialize(subtype, delimiter = ',')
@subtype = subtype
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb
index 6bf4df70eb..6c099719c0 100644
--- a/activerecord/test/cases/schema_dumper_test.rb
+++ b/activerecord/test/cases/schema_dumper_test.rb
@@ -248,6 +248,11 @@ class SchemaDumperTest < ActiveRecord::TestCase
assert_match %r{t\.integer\s+"bigint_default",\s+limit: 8,\s+default: 0}, output
end
+ def test_schema_dump_includes_limit_on_array_type
+ output = standard_dump
+ assert_match %r{t\.integer\s+"big_int_data_points\",\s+limit: 8,\s+array: true}, output
+ end
+
if ActiveRecord::Base.connection.supports_extensions?
def test_schema_dump_includes_extensions
connection = ActiveRecord::Base.connection
diff --git a/activerecord/test/schema/postgresql_specific_schema.rb b/activerecord/test/schema/postgresql_specific_schema.rb
index f84be0e7f4..008503bc24 100644
--- a/activerecord/test/schema/postgresql_specific_schema.rb
+++ b/activerecord/test/schema/postgresql_specific_schema.rb
@@ -93,4 +93,8 @@ _SQL
t.binary :binary, limit: 100_000
t.text :text, limit: 100_000
end
+
+ create_table :bigint_array, force: true do |t|
+ t.integer :big_int_data_points, limit: 8, array: true
+ end
end
diff --git a/railties/lib/rails/tasks/initializers.rake b/railties/lib/rails/tasks/initializers.rake
index c9d1b671b1..2968b5cb53 100644
--- a/railties/lib/rails/tasks/initializers.rake
+++ b/railties/lib/rails/tasks/initializers.rake
@@ -1,5 +1,5 @@
desc "Print out all defined initializers in the order they are invoked by Rails."
-task initializer: :environment do
+task initializers: :environment do
Rails.application.initializers.tsort_each do |initializer|
puts initializer.name
end
diff --git a/railties/lib/rails/test_unit/runner.rb b/railties/lib/rails/test_unit/runner.rb
index 6700d90a33..5573fa6904 100644
--- a/railties/lib/rails/test_unit/runner.rb
+++ b/railties/lib/rails/test_unit/runner.rb
@@ -1,4 +1,3 @@
-require "ostruct"
require "optparse"
require "rake/file_list"
require "method_source"
@@ -14,7 +13,7 @@ module Rails
opts.separator ""
opts.on("-e", "--environment [ENV]",
- "run tests in the ENV environment") do |env|
+ "Run tests in the ENV environment") do |env|
options[:environment] = env.strip
end
opts.separator ""
@@ -40,7 +39,7 @@ module Rails
opts.separator "Output options:"
opts.on("-b", "--backtrace",
- "show the complte backtrace") do
+ "Show the complete backtrace") do
options[:backtrace] = true
end
@@ -63,7 +62,7 @@ module Rails
options[:line] &&= options[:line].to_i
else
arg = arg.gsub(':', '')
- if Dir.exists?("#{arg}")
+ if Dir.exist?("#{arg}")
options[:patterns] << File.expand_path("#{arg}/**/*_test.rb")
elsif File.file?(arg)
options[:patterns] << File.expand_path(arg)