aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml3
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock67
-rw-r--r--actioncable/lib/action_cable/subscription_adapter/redis.rb2
-rw-r--r--activejob/test/support/integration/test_case_helpers.rb4
-rw-r--r--activerecord/lib/active_record/schema_dumper.rb4
-rw-r--r--activerecord/test/cases/schema_dumper_test.rb25
-rw-r--r--activesupport/lib/active_support/lazy_load_hooks.rb6
-rw-r--r--activesupport/test/lazy_load_hooks_test.rb13
-rw-r--r--guides/source/active_record_validations.md2
-rw-r--r--railties/lib/rails/generators/rails/controller/controller_generator.rb5
11 files changed, 78 insertions, 54 deletions
diff --git a/.travis.yml b/.travis.yml
index 95a9099901..6c7380f050 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -114,7 +114,8 @@ notifications:
on_success: change
on_failure: always
channels:
- - "irc.freenode.org#rails-contrib"
+ # "irc.freenode.org#rails-contrib"
+ - secure: "QFKSOK7xQiWWqTzYfYm0XWoW7idzuxT57MBW9i9EASyRLEPuDwZEubKRP40Y7wPx7ylQd9lp6kJheeLnrDvvTjFbW3sWv9GDRl4WlOU8sG/Kv7MXAASXlDqzyJxxXTtzLeXz2iwY296kOBuKxKxl923eTvEGeocwH02QGo14LpQ="
campfire:
on_success: change
on_failure: always
diff --git a/Gemfile b/Gemfile
index 7fc8aa7552..0b98dc1f75 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,7 +10,6 @@ gem "arel", github: "rails/arel"
# We need a newish Rake since Active Job sets its test tasks' descriptions.
gem "rake", ">= 11.1"
-gem "thor", github: "erikhuda/thor"
# This needs to be with require false to ensure correct loading order, as it has to
# be loaded after loading the test library.
diff --git a/Gemfile.lock b/Gemfile.lock
index 0738e1c35d..1fcc802b5b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -7,12 +7,6 @@ GIT
pg (>= 0.17, < 0.20)
GIT
- remote: https://github.com/erikhuda/thor.git
- revision: df5ba2b653a28087b3617d6c082b00866b0c0d6c
- specs:
- thor (0.19.4)
-
-GIT
remote: https://github.com/matthewd/rb-inotify.git
revision: 856730aad4b285969e8dd621e44808a7c5af4242
branch: close-handling
@@ -31,7 +25,7 @@ GIT
GIT
remote: https://github.com/rails/arel.git
- revision: f4227bf20a16a1d688afc24cf0038e2f98905dd4
+ revision: 42510bf71472e2e35d9becb546edd05562672344
specs:
arel (9.0.0.alpha)
@@ -117,23 +111,21 @@ GEM
public_suffix (~> 2.0, >= 2.0.2)
amq-protocol (2.2.0)
ast (2.3.0)
- aws-sdk (2.10.19)
- aws-sdk-resources (= 2.10.19)
- aws-sdk-core (2.10.19)
+ aws-sdk (2.10.27)
+ aws-sdk-resources (= 2.10.27)
+ aws-sdk-core (2.10.27)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
- aws-sdk-resources (2.10.19)
- aws-sdk-core (= 2.10.19)
+ aws-sdk-resources (2.10.27)
+ aws-sdk-core (= 2.10.27)
aws-sigv4 (1.0.1)
- azure-core (0.1.9)
+ azure-core (0.1.10)
faraday (~> 0.9)
faraday_middleware (~> 0.10)
- nokogiri (~> 1.7)
- azure-storage (0.11.4.preview)
+ azure-storage (0.12.3.preview)
azure-core (~> 0.1)
faraday (~> 0.9)
faraday_middleware (~> 0.10)
- nokogiri (~> 1.6)
backburner (1.4.1)
beaneater (~> 1.0)
concurrent-ruby (~> 1.0.1)
@@ -143,7 +135,7 @@ GEM
bcrypt (3.1.11-x86-mingw32)
beaneater (1.0.0)
benchmark-ips (2.7.2)
- blade (0.7.0)
+ blade (0.7.1)
activesupport (>= 3.0.0)
blade-qunit_adapter (~> 2.0.1)
coffee-script
@@ -153,10 +145,10 @@ GEM
faye
sprockets (>= 3.0)
thin (>= 1.6.0)
- thor (~> 0.19.1)
+ thor (>= 0.19.1)
useragent (~> 0.16.7)
blade-qunit_adapter (2.0.1)
- blade-sauce_labs_plugin (0.7.1)
+ blade-sauce_labs_plugin (0.7.2)
childprocess
faraday
selenium-webdriver
@@ -166,9 +158,9 @@ GEM
bunny (2.6.6)
amq-protocol (>= 2.1.0)
byebug (9.0.6)
- capybara (2.14.4)
+ capybara (2.15.1)
addressable
- mime-types (>= 1.16)
+ mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
@@ -213,13 +205,13 @@ GEM
et-orbi (1.0.5)
tzinfo
event_emitter (0.2.6)
- eventmachine (1.2.3)
- eventmachine (1.2.3-x64-mingw32)
- eventmachine (1.2.3-x86-mingw32)
+ eventmachine (1.2.5)
+ eventmachine (1.2.5-x64-mingw32)
+ eventmachine (1.2.5-x86-mingw32)
execjs (2.7.0)
- faraday (0.12.2)
+ faraday (0.13.0)
multipart-post (>= 1.2, < 3)
- faraday_middleware (0.12.0)
+ faraday_middleware (0.12.2)
faraday (>= 0.7.4, < 1.0)
faye (1.2.4)
cookiejar (>= 0.3.0)
@@ -249,7 +241,7 @@ GEM
googleauth (~> 0.5.1)
google-cloud-env (1.0.1)
faraday (~> 0.11)
- google-cloud-storage (1.3.0)
+ google-cloud-storage (1.4.0)
digest-crc (~> 0.4)
google-api-client (~> 0.13.0)
google-cloud-core (~> 1.0)
@@ -295,8 +287,9 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_magick (4.8.0)
+ mini_mime (0.1.4)
mini_portile2 (2.2.0)
- minitest (5.10.2)
+ minitest (5.10.3)
minitest-bisect (1.4.0)
minitest-server (~> 1.0)
path_expander (~> 1.0)
@@ -312,9 +305,9 @@ GEM
multipart-post (2.0.0)
mustache (1.0.5)
mustermann (1.0.0)
- mysql2 (0.4.8)
- mysql2 (0.4.8-x64-mingw32)
- mysql2 (0.4.8-x86-mingw32)
+ mysql2 (0.4.9)
+ mysql2 (0.4.9-x64-mingw32)
+ mysql2 (0.4.9-x86-mingw32)
nio4r (2.1.0)
nokogiri (1.8.0)
mini_portile2 (~> 2.2.0)
@@ -323,10 +316,10 @@ GEM
nokogiri (1.8.0-x86-mingw32)
mini_portile2 (~> 2.2.0)
os (0.9.6)
- parallel (1.11.2)
+ parallel (1.12.0)
parser (2.4.0.0)
ast (~> 2.2)
- path_expander (1.0.1)
+ path_expander (1.0.2)
pg (0.19.0)
pg (0.19.0-x64-mingw32)
pg (0.19.0-x86-mingw32)
@@ -340,7 +333,7 @@ GEM
qu (= 0.2.0)
redis-namespace
simple_uuid
- que (0.13.1)
+ que (0.14.0)
racc (1.4.14)
rack (2.0.3)
rack-cache (1.7.0)
@@ -398,10 +391,10 @@ GEM
rb-inotify (~> 0.9, >= 0.9.7)
sdoc (1.0.0.rc2)
rdoc (~> 5.0)
- selenium-webdriver (3.4.4)
+ selenium-webdriver (3.5.1)
childprocess (~> 0.5)
rubyzip (~> 1.0)
- sequel (4.48.0)
+ sequel (4.49.0)
serverengine (1.5.11)
sigdump (~> 0.2.2)
sidekiq (5.0.4)
@@ -444,6 +437,7 @@ GEM
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
+ thor (0.20.0)
thread (0.1.7)
thread_safe (0.3.6)
tilt (2.0.8)
@@ -535,7 +529,6 @@ DEPENDENCIES
sqlite3 (~> 1.3.6)
stackprof
sucker_punch
- thor!
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
diff --git a/actioncable/lib/action_cable/subscription_adapter/redis.rb b/actioncable/lib/action_cable/subscription_adapter/redis.rb
index c64f55f5b7..facea944ff 100644
--- a/actioncable/lib/action_cable/subscription_adapter/redis.rb
+++ b/actioncable/lib/action_cable/subscription_adapter/redis.rb
@@ -10,7 +10,7 @@ module ActionCable
class Redis < Base # :nodoc:
prepend ChannelPrefix
- # Overwrite this factory method for redis connections if you want to use a different Redis library than Redis.
+ # Overwrite this factory method for Redis connections if you want to use a different Redis library than the redis gem.
# This is needed, for example, when using Makara proxies for distributed Redis.
cattr_accessor :redis_connector, default: ->(config) do
::Redis.new(config.slice(:url, :host, :port, :db, :password))
diff --git a/activejob/test/support/integration/test_case_helpers.rb b/activejob/test/support/integration/test_case_helpers.rb
index 9629876a6d..f02a32a38e 100644
--- a/activejob/test/support/integration/test_case_helpers.rb
+++ b/activejob/test/support/integration/test_case_helpers.rb
@@ -1,6 +1,5 @@
# frozen_string_literal: true
-require "active_support/core_ext/string/inflections"
require "support/integration/jobs_manager"
module TestCaseHelpers
@@ -30,8 +29,7 @@ module TestCaseHelpers
end
def adapter_is?(*adapter_class_symbols)
- adapter = ActiveJob::Base.queue_adapter.class.name.demodulize.chomp("Adapter").underscore
- adapter_class_symbols.map(&:to_s).include? adapter
+ adapter_class_symbols.map(&:to_s).include? ActiveJob::Base.queue_adapter_name
end
def wait_for_jobs_to_finish_for(seconds = 60)
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb
index 27a1c89bd1..fd644225ca 100644
--- a/activerecord/lib/active_record/schema_dumper.rb
+++ b/activerecord/lib/active_record/schema_dumper.rb
@@ -243,7 +243,9 @@ HEADER
end
def remove_prefix_and_suffix(table)
- table.gsub(/^(#{@options[:table_name_prefix]})(.+)(#{@options[:table_name_suffix]})$/, "\\2")
+ prefix = Regexp.escape(@options[:table_name_prefix].to_s)
+ suffix = Regexp.escape(@options[:table_name_suffix].to_s)
+ table.sub(/\A#{prefix}(.+)#{suffix}\z/, "\\1")
end
def ignored?(table_name)
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb
index 01ec3e06ad..eb9b257da9 100644
--- a/activerecord/test/cases/schema_dumper_test.rb
+++ b/activerecord/test/cases/schema_dumper_test.rb
@@ -400,6 +400,31 @@ class SchemaDumperTest < ActiveRecord::TestCase
$stdout = original
end
+ def test_schema_dump_with_table_name_prefix_and_suffix_regexp_escape
+ original, $stdout = $stdout, StringIO.new
+ ActiveRecord::Base.table_name_prefix = "foo$"
+ ActiveRecord::Base.table_name_suffix = "$bar"
+
+ migration = CreateDogMigration.new
+ migration.migrate(:up)
+
+ output = perform_schema_dump
+ assert_no_match %r{create_table "foo\$.+\$bar"}, output
+ assert_no_match %r{add_index "foo\$.+\$bar"}, output
+ assert_no_match %r{create_table "schema_migrations"}, output
+ assert_no_match %r{create_table "ar_internal_metadata"}, output
+
+ if ActiveRecord::Base.connection.supports_foreign_keys?
+ assert_no_match %r{add_foreign_key "foo\$.+\$bar"}, output
+ assert_no_match %r{add_foreign_key "[^"]+", "foo\$.+\$bar"}, output
+ end
+ ensure
+ migration.migrate(:down)
+
+ ActiveRecord::Base.table_name_suffix = ActiveRecord::Base.table_name_prefix = ""
+ $stdout = original
+ end
+
def test_schema_dump_with_table_name_prefix_and_ignoring_tables
original, $stdout = $stdout, StringIO.new
diff --git a/activesupport/lib/active_support/lazy_load_hooks.rb b/activesupport/lib/active_support/lazy_load_hooks.rb
index c124416595..dc8080c469 100644
--- a/activesupport/lib/active_support/lazy_load_hooks.rb
+++ b/activesupport/lib/active_support/lazy_load_hooks.rb
@@ -40,7 +40,7 @@ module ActiveSupport
# * <tt>:run_once</tt> - Given +block+ will run only once.
def on_load(name, options = {}, &block)
@loaded[name].each do |base|
- execute_hook(base, options, block)
+ execute_hook(name, base, options, block)
end
@load_hooks[name] << [block, options]
@@ -49,7 +49,7 @@ module ActiveSupport
def run_load_hooks(name, base = Object)
@loaded[name] << base
@load_hooks[name].each do |hook, options|
- execute_hook(base, options, hook)
+ execute_hook(name, base, options, hook)
end
end
@@ -63,7 +63,7 @@ module ActiveSupport
end
end
- def execute_hook(base, options, block)
+ def execute_hook(name, base, options, block)
with_execution_control(name, block, options[:run_once]) do
if options[:yield]
block.call(base)
diff --git a/activesupport/test/lazy_load_hooks_test.rb b/activesupport/test/lazy_load_hooks_test.rb
index c161005100..721d44d0c1 100644
--- a/activesupport/test/lazy_load_hooks_test.rb
+++ b/activesupport/test/lazy_load_hooks_test.rb
@@ -22,14 +22,19 @@ class LazyLoadHooksTest < ActiveSupport::TestCase
def test_basic_hook_with_two_registrations_only_once
i = 0
- ActiveSupport.on_load(:basic_hook_with_two_once, run_once: true) do
+ block = proc { i += incr }
+ ActiveSupport.on_load(:basic_hook_with_two_once, run_once: true, &block)
+ ActiveSupport.on_load(:basic_hook_with_two_once) do
i += incr
end
- assert_equal 0, i
- ActiveSupport.run_load_hooks(:basic_hook_with_two_once, FakeContext.new(2))
+
+ ActiveSupport.on_load(:different_hook, run_once: true, &block)
+ ActiveSupport.run_load_hooks(:different_hook, FakeContext.new(2))
assert_equal 2, i
+ ActiveSupport.run_load_hooks(:basic_hook_with_two_once, FakeContext.new(2))
+ assert_equal 6, i
ActiveSupport.run_load_hooks(:basic_hook_with_two_once, FakeContext.new(5))
- assert_equal 2, i
+ assert_equal 11, i
end
def test_hook_registered_after_run
diff --git a/guides/source/active_record_validations.md b/guides/source/active_record_validations.md
index a086363cf1..e9157f3db1 100644
--- a/guides/source/active_record_validations.md
+++ b/guides/source/active_record_validations.md
@@ -892,7 +892,7 @@ Conditional Validation
Sometimes it will make sense to validate an object only when a given predicate
is satisfied. You can do that by using the `:if` and `:unless` options, which
-can take a symbol, a string, a `Proc` or an `Array`. You may use the `:if`
+can take a symbol, a `Proc` or an `Array`. You may use the `:if`
option when you want to specify when the validation **should** happen. If you
want to specify when the validation **should not** happen, then you may use the
`:unless` option.
diff --git a/railties/lib/rails/generators/rails/controller/controller_generator.rb b/railties/lib/rails/generators/rails/controller/controller_generator.rb
index ab0594fc3c..6d45d6e8f8 100644
--- a/railties/lib/rails/generators/rails/controller/controller_generator.rb
+++ b/railties/lib/rails/generators/rails/controller/controller_generator.rb
@@ -16,7 +16,7 @@ module Rails
def add_routes
return if options[:skip_routes]
- route generate_routing_code(actions)
+ route generate_routing_code
end
hook_for :template_engine, :test_framework, :helper, :assets
@@ -32,7 +32,7 @@ module Rails
# get 'baz/show'
# end
# end
- def generate_routing_code(action)
+ def generate_routing_code
depth = 0
lines = []
@@ -46,6 +46,7 @@ module Rails
# Create route
# get 'baz/index'
+ # get 'baz/show'
actions.each do |action|
lines << indent(%{get '#{file_name}/#{action}'\n}, depth * 2)
end