Class: Paperclip::Attachment
- Inherits:
-
Object
- Object
- Paperclip::Attachment
- Extended by:
- ActiveSupport::Memoizable
- Defined in:
- app/liquid/cms_paperclip_extension.rb
Instance Method Summary collapse
-
#post_process_with_dimension_attribute_clear ⇒ Object
clear out the dimension attribute when post processing it’ll be updated on the next render via to_liquid.
- #to_liquid ⇒ Object
Instance Method Details
#post_process_with_dimension_attribute_clear ⇒ Object
clear out the dimension attribute when post processing it’ll be updated on the next render via to_liquid
24 25 26 27 28 29 30 31 32 |
# File 'app/liquid/cms_paperclip_extension.rb', line 24 def post_process_with_dimension_attribute_clear key = dimension_key if instance.has_attribute?(key) instance.send("#{key}=", nil) end post_process_without_dimension_attribute_clear end |
#to_liquid ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/liquid/cms_paperclip_extension.rb', line 5 def to_liquid style_hash = {} style_hash.tap do |h| all_styles = self.styles.keys + ['original'] all_styles.each do |style| h[style.to_s] = find_geometry_dims(style) h[style.to_s]['url'] = self.url(style) if h[style.to_s].present? end end save_geometry_dims style_hash style_hash end |