提交 1b36e2cc 编写于 作者: M Matthew Draper 提交者: GitHub

Merge pull request #30836 from shioyama/generated_attribute_methods_include_mutex

Include Mutex_m into GeneratedAttributeMethods instead of extending instance
......@@ -33,7 +33,9 @@ def self.set_name_cache(name, value)
BLACKLISTED_CLASS_METHODS = %w(private public protected allocate new name parent superclass)
class GeneratedAttributeMethods < Module; end # :nodoc:
class GeneratedAttributeMethods < Module #:nodoc:
include Mutex_m
end
module ClassMethods
def inherited(child_class) #:nodoc:
......@@ -42,7 +44,7 @@ def inherited(child_class) #:nodoc:
end
def initialize_generated_modules # :nodoc:
@generated_attribute_methods = GeneratedAttributeMethods.new { extend Mutex_m }
@generated_attribute_methods = GeneratedAttributeMethods.new
@attribute_methods_generated = false
include @generated_attribute_methods
......
......@@ -999,6 +999,11 @@ def some_method_that_is_not_on_super
assert_equal ["title"], model.accessed_fields
end
test "generated attribute methods ancestors have correct class" do
mod = Topic.send(:generated_attribute_methods)
assert_match %r(GeneratedAttributeMethods), mod.inspect
end
private
def new_topic_like_ar_class(&block)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册