From 6c7e6abfaad149da02dbec4e4f2bd62c5d68805f Mon Sep 17 00:00:00 2001 From: Kevin Deisz <kevin.deisz@gmail.com> Date: Thu, 31 May 2018 21:15:51 -0400 Subject: Ensure reflection_class_for is private --- activestorage/lib/active_storage/reflection.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'activestorage/lib') diff --git a/activestorage/lib/active_storage/reflection.rb b/activestorage/lib/active_storage/reflection.rb index 9074b20126..04a1b20882 100644 --- a/activestorage/lib/active_storage/reflection.rb +++ b/activestorage/lib/active_storage/reflection.rb @@ -18,21 +18,22 @@ module ActiveStorage end end - module ReflectionExtension - def reflection_class_for(macro) - case macro - when :has_one_attached - HasOneAttachedReflection - when :has_many_attached - HasManyAttachedReflection - else - super - end - end - + module ReflectionExtension # :nodoc: def add_attachment_reflection(ar, name, reflection) ar.attachment_reflections.merge!(name.to_s => reflection) end + + private + def reflection_class_for(macro) + case macro + when :has_one_attached + HasOneAttachedReflection + when :has_many_attached + HasManyAttachedReflection + else + super + end + end end module ActiveRecordExtensions -- cgit v1.2.3