diff --git a/lib/new_relic/environment_report.rb b/lib/new_relic/environment_report.rb index 2ea969d49b..c15012da34 100644 --- a/lib/new_relic/environment_report.rb +++ b/lib/new_relic/environment_report.rb @@ -44,8 +44,11 @@ def self.registered_reporters=(logic) #################################### report_on('Gems') do begin - specs_method = Bundler::VERSION >= '2' ? :installed_specs : :all_specs - Bundler.rubygems.send(specs_method).map { |gem| "#{gem.name} (#{gem.version})" } + if Bundler::VERSION >= '2' + Bundler.rubygems.installed_specs.map { |gem| "#{gem.name}(#{gem.version})" } + else + Bundler.rubygems.all_specs.map { |gem| "#{gem.name}(#{gem.version})" } + end rescue # There are certain rubygem, bundler, rails combinations (e.g. gem # 1.6.2, rails 2.3, bundler 1.2.3) where the code above throws an error