diff options
Diffstat (limited to 'app/models/media_attachment.rb')
-rw-r--r-- | app/models/media_attachment.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb new file mode 100644 index 000000000..af1a4b9af --- /dev/null +++ b/app/models/media_attachment.rb @@ -0,0 +1,13 @@ +class MediaAttachment < ApplicationRecord + belongs_to :account, inverse_of: :media_attachments + belongs_to :status, inverse_of: :media_attachments + + has_attached_file :file + validates_attachment_content_type :file, content_type: /\Aimage\/.*\z/ + + validates :account, presence: true + + def local? + self.remote_url.blank? + end +end |