Created
October 29, 2008 19:20
-
-
Save julesfern/20788 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment