aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorAndrew White <pixeltrix@users.noreply.github.com>2016-11-11 20:05:10 +0000
committerGitHub <noreply@github.com>2016-11-11 20:05:10 +0000
commit6b830dc930a5d684c05b028757b06834df4d064d (patch)
treecce822e4496b50a6bd5b121a540447f59f59e3e4 /actionpack/lib
parente4b0a5f66ebd2b7f29e4f868d2f6b2504df091e6 (diff)
parent9b103311d5d266fa509f5da8825ea5daecba1836 (diff)
downloadrails-6b830dc930a5d684c05b028757b06834df4d064d.tar.gz
rails-6b830dc930a5d684c05b028757b06834df4d064d.tar.bz2
rails-6b830dc930a5d684c05b028757b06834df4d064d.zip
Merge pull request #26962 from rails/fix-3-2-stable-on-ruby-2-3
Fix Rails 3-2-stable on Ruby 2.3.1
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/abstract_controller/helpers.rb15
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb2
-rw-r--r--actionpack/lib/action_view/template.rb3
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb2
4 files changed, 18 insertions, 4 deletions
diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb
index 77cc4c07d9..7a9055a679 100644
--- a/actionpack/lib/abstract_controller/helpers.rb
+++ b/actionpack/lib/abstract_controller/helpers.rb
@@ -12,6 +12,15 @@ module AbstractController
self._helper_methods = Array.new
end
+ class MissingHelperError < LoadError
+ def initialize(error, path)
+ @error = error
+ @path = "helpers/#{path}.rb"
+ set_backtrace error.backtrace
+ super("Missing helper file helpers/%s.rb" % path)
+ end
+ end
+
module ClassMethods
# When a class is inherited, wrap its helper module in a new module.
# This ensures that the parent class's module can be changed
@@ -132,7 +141,11 @@ module AbstractController
case arg
when String, Symbol
file_name = "#{arg.to_s.underscore}_helper"
- require_dependency(file_name, "Missing helper file helpers/%s.rb")
+ begin
+ require_dependency(file_name)
+ rescue LoadError => e
+ raise MissingHelperError.new(e, file_name)
+ end
file_name.camelize.constantize
when Module
arg
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb
index 05d5f1870a..edfc374b3b 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb
@@ -47,7 +47,7 @@ module ActionView
if concat || (config.perform_caching && cache)
joined_name = (cache == true ? "all" : cache) + ".#{extension}"
joined_path = File.join((joined_name[/^#{File::SEPARATOR}/] ? config.assets_dir : custom_dir), joined_name)
- unless config.perform_caching && File.exists?(joined_path)
+ unless config.perform_caching && File.exist?(joined_path)
write_asset_file_contents(joined_path, compute_paths(sources, recursive))
end
asset_tag(joined_name, options)
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index e67e52cc76..069ac4e761 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -323,7 +323,8 @@ module ActionView
end
def locals_code #:nodoc:
- @locals.map { |key| "#{key} = local_assigns[:#{key}];" }.join
+ # Double assign to suppress the dreaded 'assigned but unused variable' warning
+ @locals.map { |key| "#{key} = #{key} = local_assigns[:#{key}];" }.join
end
def method_name #:nodoc:
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb
index 243c2e5e50..6712aefb2d 100644
--- a/actionpack/lib/sprockets/helpers/rails_helper.rb
+++ b/actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -163,7 +163,7 @@ module Sprockets
source
elsif source_ext.blank?
"#{source}.#{ext}"
- elsif File.exists?(source) || exact_match_present?(source)
+ elsif File.exist?(source) || exact_match_present?(source)
source
else
"#{source}.#{ext}"