diff options
-rw-r--r-- | activerecord/test/cases/schema_authorization_test_postgresql.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/activerecord/test/cases/schema_authorization_test_postgresql.rb b/activerecord/test/cases/schema_authorization_test_postgresql.rb index 7a0796ef53..ba7754513d 100644 --- a/activerecord/test/cases/schema_authorization_test_postgresql.rb +++ b/activerecord/test/cases/schema_authorization_test_postgresql.rb @@ -18,8 +18,8 @@ class SchemaAuthorizationTest < ActiveRecord::TestCase @connection.execute "SET search_path TO '$user',public" set_session_auth USERS.each do |u| - @connection.execute "CREATE USER #{u}" - @connection.execute "CREATE SCHEMA AUTHORIZATION #{u}" + @connection.execute "CREATE USER #{u}" rescue nil + @connection.execute "CREATE SCHEMA AUTHORIZATION #{u}" rescue nil set_session_auth u @connection.execute "CREATE TABLE #{TABLE_NAME} (#{COLUMNS.join(',')})" @connection.execute "INSERT INTO #{TABLE_NAME} (name) VALUES ('#{u}')" diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb index da89b30c54..e2d19cdd45 100644 --- a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +++ b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb @@ -4,6 +4,7 @@ module I18n module Backend class Simple INTERPOLATION_RESERVED_KEYS = %w(scope default) + DEPRECATED_INTERPOLATORS = { '%d' => '{{count}}', '%s' => '{{value}}' } MATCH = /(\\\\)?\{\{([^\}]+)\}\}/ # Accepts a list of paths to translation files. Loads translations from @@ -107,7 +108,7 @@ module I18n raise InvalidPluralizationData.new(entry, count) unless entry.has_key?(key) entry[key] end - + # Interpolates values into a given string. # # interpolate "file {{file}} opened by \\{{user}}", :file => 'test.txt', :user => 'Mr. X' @@ -119,7 +120,11 @@ module I18n def interpolate(locale, string, values = {}) return string unless string.is_a?(String) - string = string.gsub(/%d/, '{{count}}').gsub(/%s/, '{{value}}') + string = string.gsub(/%d|%s/) do |s| + instead = DEPRECATED_INTERPOLATORS[s] + ActiveSupport::Deprecation.warn "using #{s} in messages is deprecated; use #{instead} instead." + instead + end if string.respond_to?(:force_encoding) original_encoding = string.encoding |