import.rb 878 B

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