Method: Paperclip.missing_attachments_styles
- Defined in:
- lib/paperclip/missing_attachment_styles.rb
permalink .missing_attachments_styles ⇒ Object
Returns hash with styles missing from recent run of rake paperclip:refresh:missing_styles
{
:User => {:avatar => [:big]},
:Book => {
:cover => [:croppable]},
}
}
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/paperclip/missing_attachment_styles.rb', line 59 def self. current_styles = registered_styles = Hash.new.tap do |missing_styles| current_styles.each do |klass, | .each do |, styles| registered = registered_styles[klass][] || [] rescue [] missed = styles - registered if missed.present? klass_sym = klass.to_s.to_sym missing_styles[klass_sym] ||= Hash.new missing_styles[klass_sym][.to_sym] ||= Array.new missing_styles[klass_sym][.to_sym].concat(missed.to_a) missing_styles[klass_sym][.to_sym].map!(&:to_s).sort!.map!(&:to_sym).uniq! end end end end end |