Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected
- def validate
- errors.add("Uploaded file", "is not a valid image file.") unless uploaded_file_has_valid_extension? if new_record?
- end
- def uploaded_file_has_valid_extension?
- %w(.jpg .png).include?(File.extname(self.file.path)) if self.file
- end
Add Comment
Please, Sign In to add comment