Sha256: b626a2acaa4a01b656fdf5817d473bcebf000c7beac8ddba0082a3f2e146fcec
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true if defined?(ActiveRecord) && defined?(ActiveRecord::AttributeMethods) && defined?(ActiveRecord::AttributeMethods::Read) && defined?(ActiveRecord::AttributeMethods::Read::ClassMethods) module ActiveRecord module AttributeMethods module Read # Rails / ActiveRecord are sneaky a.f. They define attributes of a # class in one method, then monkey patch allocate in another and # finally invoke module_eval in this method... but of course they use a # '_tmp_' header for the method name and then alias it in this module # to name it what we expect module ClassMethods alias_method :cs__patched_define_method_attribute, :define_method_attribute def define_method_attribute *args, &block ret = cs__patched_define_method_attribute(*args, &block) method_name = args[0] Contrast::Agent::Assess::Policy::Patcher.patch_assess_method(self, method_name) ret end protected :cs__patched_define_method_attribute, :define_method_attribute end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
contrast-agent-3.8.5 | lib/contrast/rails_extensions/assess/active_record.rb |
contrast-agent-3.8.4 | lib/contrast/rails_extensions/assess/active_record.rb |