Commit acf957c4 by Prem Sichanugrist

Update the documentation to say that we require the virtual attribute to be…

Update the documentation to say that we require the virtual attribute to be defined in order to use the validation.
parent 0362b9e7
...@@ -351,6 +351,8 @@ module Paperclip ...@@ -351,6 +351,8 @@ module Paperclip
# NOTE: If you do not specify an [attachment]_content_type field on your # NOTE: If you do not specify an [attachment]_content_type field on your
# model, content_type validation will work _ONLY upon assignment_ and # model, content_type validation will work _ONLY upon assignment_ and
# re-validation after the instance has been reloaded will always succeed. # re-validation after the instance has been reloaded will always succeed.
# You'll still need to have a virtual attribute (created by +attr_accessor+)
# name +[attachment]_content_type+ to be able to use this validator.
def validates_attachment_content_type name, options = {} def validates_attachment_content_type name, options = {}
validation_options = options.dup validation_options = options.dup
allowed_types = [validation_options[:content_type]].flatten allowed_types = [validation_options[:content_type]].flatten
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment