Class: PostImage
- Inherits:
-
Asset
- Object
- Asset
- PostImage
- Defined in:
- app/models/post_image.rb
Instance Method Summary collapse
- #attachment_sizes ⇒ Object
- #has_alt? ⇒ Boolean
- #image_content? ⇒ Boolean
- #no_attachement_errors ⇒ Object
Instance Method Details
#attachment_sizes ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/models/post_image.rb', line 17 def if image_content? { :mini => '48x48>', :small => '150x150>', :medium => '600x600>', :large => '950x700>' } else {} end end |
#has_alt? ⇒ Boolean
13 14 15 |
# File 'app/models/post_image.rb', line 13 def has_alt? !self.alt.blank? end |
#image_content? ⇒ Boolean
9 10 11 |
# File 'app/models/post_image.rb', line 9 def image_content? .match(/\/(jpeg|png|gif|tiff|x-photoshop)/) end |
#no_attachement_errors ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/models/post_image.rb', line 25 def no_attachement_errors unless .errors.empty? # uncomment this to get rid of the less-than-useful interrim messages # errors.clear errors.add :attachment, "Paperclip returned errors for file '#{}' - check ImageMagick installation or image source file." false end end |