diff --git a/lib/paperclip/storage/database.rb b/lib/paperclip/storage/database.rb index 09613dc..b8fd6ee 100644 --- a/lib/paperclip/storage/database.rb +++ b/lib/paperclip/storage/database.rb @@ -108,10 +108,11 @@ def setup_paperclip_file_model def setup_attachment_class instance.class.ancestors.each do |ancestor| + next unless ancestor.respond_to?(:attachment_definitions) + # Pick the top-most definition like # Paperclip::AttachmentRegistry#definitions_for - names_for_ancestor = ancestor.attachment_definitions.keys rescue [] - if names_for_ancestor.member?(name) + if ancestor.attachment_definitions.member?(name) @attachment_class = ancestor end end