Sha256: 778fdf0ec778da4b3ecc3856a798ccf224260c7a08040937bc4e3530fd73303c
Contents?: true
Size: 662 Bytes
Versions: 16
Compression:
Stored size: 662 Bytes
Contents
module Adminsite class FileAsset < ActiveRecord::Base has_attached_file :attachment validates_with AttachmentPresenceValidator, :attributes => :attachment validates_with AttachmentSizeValidator, :attributes => :attachment, :less_than => 2.megabytes validates_attachment :attachment, content_type: { content_type: /\A.*\Z/ } # do_not_validate_attachment_file_type :image class << self def attachment_url_for(name) asset = find_by_attachment_file_name(name) if asset.nil? "http://missing.jpg?#{name}" else asset.attachment.url(:original, false) end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems