Guest User

Untitled

a guest
Feb 21st, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. def valid_extensions
  2. @@valids ||= Regexp.new("\." + Extension.find(:all).map(&:name).join('|') + '$')
  3. end
  4.  
  5. =====
  6.  
  7. errors.add(:image, "invalid file type") unless image_name =~ valid_extensions
Add Comment
Please, Sign In to add comment