2014-12-28 10:13:49 -06:00
|
|
|
class UserExport < ActiveRecord::Base
|
2018-06-04 20:41:40 -05:00
|
|
|
belongs_to :user
|
2019-04-03 03:01:19 -05:00
|
|
|
belongs_to :upload, dependent: :destroy
|
2014-12-24 03:11:41 -06:00
|
|
|
|
|
|
|
def self.remove_old_exports
|
2018-06-04 20:41:40 -05:00
|
|
|
UserExport.where('created_at < ?', 2.days.ago).find_each do |user_export|
|
|
|
|
user_export.destroy!
|
2014-12-24 03:11:41 -06:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.base_directory
|
|
|
|
File.join(Rails.root, "public", "uploads", "csv_exports", RailsMultisite::ConnectionManagement.current_db)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
# == Schema Information
|
|
|
|
#
|
2014-12-28 10:13:49 -06:00
|
|
|
# Table name: user_exports
|
2014-12-24 03:11:41 -06:00
|
|
|
#
|
2015-02-03 23:34:25 -06:00
|
|
|
# id :integer not null, primary key
|
2019-01-11 13:29:56 -06:00
|
|
|
# file_name :string not null
|
2015-02-03 23:34:25 -06:00
|
|
|
# user_id :integer not null
|
2019-01-11 13:29:56 -06:00
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
2018-04-19 06:30:31 -05:00
|
|
|
# upload_id :integer
|
2014-12-24 03:11:41 -06:00
|
|
|
#
|