Advertisement
guiil

upload.rb

Feb 22nd, 2017
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.55 KB | None | 0 0
  1. class Upload < ActiveRecord::Base
  2.   has_attached_file :document, styles: { thumbnail: "60x60#" }
  3.   validates_attachment :document, content_type: { content_type: ["application/pdf","application/vnd.ms-excel",
  4.              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
  5.              "application/msword",
  6.              "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
  7.              "text/plain"] }
  8.   validates :name, presence: true
  9.   validates_format_of :email,:with => /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/
  10. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement