mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
AMS 0.8: Fix memory leak with :scope_name (#1675)
Fix memory leak with :scope_name Supplying :scope_name causes `ActiveModel::Serializer#initialize` to define a method on the class, which retains a reference to the serializer instance. * Lock version of mime-types to < 3 for older JRubies
This commit is contained in:
parent
e54d129091
commit
07addbf8c7
5
Gemfile
5
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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user