diff --git a/Gemfile b/Gemfile index 06e858e4..476d7682 100644 --- a/Gemfile +++ b/Gemfile @@ -31,3 +31,8 @@ end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: (@windows_platforms + [:jruby]) + +# JRuby versions before 9.x report their version as "1.9.x" or lower, so lock these to an older version of mime-types +if defined?(JRUBY_VERSION) and Gem::ruby_version < Gem::Version.new("2.0.0") + gem 'mime-types', '< 3' +end diff --git a/lib/active_model/serializer.rb b/lib/active_model/serializer.rb index ef47178b..694cf61f 100644 --- a/lib/active_model/serializer.rb +++ b/lib/active_model/serializer.rb @@ -294,9 +294,7 @@ module ActiveModel scope_name = @options[:scope_name] if scope_name && !respond_to?(scope_name) - self.class.class_eval do - define_method scope_name, lambda { scope } - end + self.singleton_class.send :alias_method, scope_name, :scope end end