Created
May 26, 2012 08:48
-
-
Save jhjguxin/2792959 to your computer and use it in GitHub Desktop.
Paperclip skip no img file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
has_attached_file :face, | |
:default_style => :s120, | |
:styles => { | |
:normal => "180x180#", | |
:s120 => "120x120#", | |
:s48 => "48x48#", | |
:s32 => "32x32#", | |
:s16 => "16x16#" | |
}, | |
:url => Askjane::MetaCache.get_config_data("profile_face_url"), | |
:path => Askjane::MetaCache.get_config_data("profile_face_path") | |
validates_attachment_content_type :face, :content_type => ['image/jpg', 'image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png'] | |
validates :face, :presence => true | |
validates_attachment_size :face, :less_than => 2.megabytes, | |
:unless => Proc.new {|m| m[:face].nil?} | |
before_post_process :image? | |
def image? | |
#breakpoint | |
!((self.face.content_type =~ /^image\/*/).nil?) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment