我使用回形针将头像附加到用户,效果很好,但是当新用户尝试注册时,它会抱怨头像 bieng 太小而且类型不正确。
这就是我验证我的头像的方式:
validates_attachment_size :avatar, :less_than => 1.megabytes
validates_attachment_content_type :avatar, :content_type => ['image/jpeg', 'image/png', 'image/gif']
这是我尝试注册时遇到的错误。
There were problems with the following fields:
* Avatar file size file size must be between 0 and 1048576 bytes.
* Avatar content type is not included in the list
有没有办法让头像可以是空白的?