From 13dd7758cedf6152835c4c72b69b1fe631a60733 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Tue, 23 Aug 2011 11:02:44 +0200 Subject: [PATCH] remove useless rescue params is a method, defined in every controller, which always returns a hash. If it raises a NoMethodError, it means there's a bug somewhere else, which we want to know about. --- actionpack/lib/sprockets/helpers/rails_helper.rb | 9 +++------ actionpack/test/abstract_unit.rb | 6 +++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb index 7200ab1ddd..4fb8d0af37 100644 --- a/actionpack/lib/sprockets/helpers/rails_helper.rb +++ b/actionpack/lib/sprockets/helpers/rails_helper.rb @@ -70,12 +70,9 @@ module Sprockets private def debug_assets? - begin - params[:debug_assets] == '1' || - params[:debug_assets] == 'true' - rescue NoMethodError - false - end || Rails.application.config.assets.debug + params[:debug_assets] == '1' || + params[:debug_assets] == 'true' || + Rails.application.config.assets.debug end # Override to specify an alternative prefix for asset path generation. diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 24d071df39..aa7a01f6c9 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -142,7 +142,11 @@ class RoutedRackApp end class BasicController - attr_accessor :request + attr_accessor :request, :params + + def initialize + @params = {} + end def config @config ||= ActiveSupport::InheritableOptions.new(ActionController::Base.config).tap do |config|