You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
893 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: imports
  5. #
  6. # id :integer not null, primary key
  7. # account_id :integer not null
  8. # type :integer not null
  9. # approved :boolean
  10. # created_at :datetime not null
  11. # updated_at :datetime not null
  12. # data_file_name :string
  13. # data_content_type :string
  14. # data_file_size :integer
  15. # data_updated_at :datetime
  16. #
  17. class Import < ApplicationRecord
  18. FILE_TYPES = ['text/plain', 'text/csv'].freeze
  19. self.inheritance_column = false
  20. belongs_to :account, required: true
  21. enum type: [:following, :blocking, :muting]
  22. validates :type, presence: true
  23. has_attached_file :data, url: '/system/:hash.:extension', hash_secret: ENV['PAPERCLIP_SECRET']
  24. validates_attachment_content_type :data, content_type: FILE_TYPES
  25. end