aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_dispatch/http/parameters.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb15
-rw-r--r--activerecord/test/cases/adapters/postgresql/uuid_test.rb1
3 files changed, 8 insertions, 10 deletions
diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb
index 246d9c121a..20c24ddd85 100644
--- a/actionpack/lib/action_dispatch/http/parameters.rb
+++ b/actionpack/lib/action_dispatch/http/parameters.rb
@@ -65,7 +65,7 @@ module ActionDispatch
new_hash = {}
params.each do |k, v|
- new_key = k.is_a?(String) ? k.dup.force_encoding("UTF-8").encode! : k
+ new_key = k.is_a?(String) ? k.dup.force_encoding(Encoding::UTF_8).encode! : k
new_hash[new_key] =
case v
when Hash
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 6040eeed00..654aac8453 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -340,10 +340,10 @@ module ActiveRecord
# end
#
# By default, this will use the +uuid_generate_v4()+ function from the
- # +uuid-ossp+ extension, which MUST be enabled on your databse. To enable
+ # +uuid-ossp+ extension, which MUST be enabled on your database. To enable
# the +uuid-ossp+ extension, you can use the +enable_extension+ method in your
- # migrations To use a UUID primary key without +uuid-ossp+ enabled, you can
- # set the +:default+ option to nil:
+ # migrations. To use a UUID primary key without +uuid-ossp+ enabled, you can
+ # set the +:default+ option to +nil+:
#
# create_table :stuffs, id: false do |t|
# t.primary_key :id, :uuid, default: nil
@@ -354,11 +354,10 @@ module ActiveRecord
# You may also pass a different UUID generation function from +uuid-ossp+
# or another library.
#
- # Note that setting the UUID primary key default value to +nil+
- # will require you to assure that you always provide a UUID value
- # before saving a record (as primary keys cannot be nil). This might be
- # done via the SecureRandom.uuid method and a +before_save+ callback,
- # for instance.
+ # Note that setting the UUID primary key default value to +nil+ will
+ # require you to assure that you always provide a UUID value before saving
+ # a record (as primary keys cannot be +nil+). This might be done via the
+ # +SecureRandom.uuid+ method and a +before_save+ callback, for instance.
def primary_key(name, type = :primary_key, options = {})
return super unless type == :uuid
options[:default] = options.fetch(:default, 'uuid_generate_v4()')
diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb
index edf18cb7a7..04c9065393 100644
--- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb
@@ -59,7 +59,6 @@ class PostgresqlUUIDTestNilDefault < ActiveRecord::TestCase
def setup
@connection = ActiveRecord::Base.connection
-
@connection.reconnect!
@connection.transaction do