Skip to content

Instantly share code, notes, and snippets.

@jhjguxin
Created May 26, 2012
Embed
What would you like to do?
Paperclip skip no img file
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