episode-178/todo/vendor/plugins/paperclip/lib/paperclip.rb
# Places ActiveRecord-style validations on the content type of the file
# assigned. The possible options are: 
# * +content_type+: Allowed content types.  Can be a single content type 
#   or an array.  Each type can be a String or a Regexp. It should be 
#   noted that Internet Explorer upload files with content_types that you 
#   may not expect. For example, JPEG images are given image/pjpeg and 
#   PNGs are image/x-png, so keep that in mind when determining how you 
#   match.  Allows all by default.
# * +message+: The message to display when the uploaded file has an invalid
#   content type.
# * +if+: A lambda or name of a method on the instance. Validation will only
#   be run is this lambda or method returns true.
# * +unless+: Same as +if+ but validates if lambda or method returns false.
# NOTE: If you do not specify an [attachment]_content_type field on your
# model, content_type validation will work _ONLY upon assignment_ and
# re-validation after the instance has been reloaded will always succeed.
Places ActiveRecord-style validations on the content type of the file
assigned. The possible options are:
+content_type+: Allowed content types.  Can be a single content type
or an array.  Each type can be a String or a Regexp. It should be
noted that Internet Explorer upload files with content_types that you
may not expect. For example, JPEG images are given image/pjpeg and
PNGs are image/x-png, so keep that in mind when determining how you
match.  Allows all by default.
+message+: The message to display when the uploaded file has an invalid
content type.
+if+: A lambda or name of a method on the instance. Validation will only
be run is this lambda or method returns true.
+unless+: Same as +if+ but validates if lambda or method returns false.
NOTE: If you do not specify an [attachment]_content_type field on your
model, content_type validation will work _ONLY upon assignment_ and
re-validation after the instance has been reloaded will always succeed.
Places ActiveRecord - style validations on the content type of the file assigned . The possible options are : + content_type + : Allowed content types . Can be a single content type or an array . Each type can be a String or a Regexp . It should be noted that Internet Explorer upload files with content_types that you may not expect . For example JPEG images are given image / pjpeg and PNGs are image / x - png so keep that in mind when determining how you match . Allows all by default . + message + : The message to display when the uploaded file has an invalid content type . + if + : A lambda or name of a method on the instance . Validation will only be run is this lambda or method returns true . + unless + : Same as + if + but validates if lambda or method returns false . NOTE : If you do not specify an [ attachment ] _content_type field on your model content_type validation will work _ONLY upon assignment_ and re - validation after the instance has been reloaded will always succeed .
def validates_attachment_content_type name, options = {}
      attachment_definitions[name][:validations] << [:content_type, {:content_type => options[:content_type],
                                                                     :message      => options[:message],
                                                                     :if           => options[:if],
                                                                     :unless       => options[:unless]}]
    end
def validates_attachment_content_type name , options = { } attachment_definitions [ name ] [ :validations ] << [ :content_type , { :content_type => options [ :content_type ] , :message => options [ :message ] , :if => options [ :if ] , :unless => options [ :unless ] } ] end
Places ActiveRecord-style validations on the content type of the file
assigned.
Places ActiveRecord - style validations on the content type of the file assigned .
name
options