Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

apecherin's Profile

GitHub User: apecherin

Comments by

Avatar

Please any idea of use delayed_jobs for multitenant app with Postgresql schemas.
Each task puts in current schema to the moment. But DJ getting tasks from public schema only.

Avatar

You can try use uniq name of uploaded files-

ruby
def filename
    random_token = Digest::SHA2.hexdigest("#{Time.now.utc}--#{model.id.to_s}").first(40)
    ivar = "@#{mounted_as}_secure_token"
    token = model.instance_variable_get(ivar)
    token ||= model.instance_variable_set(ivar, random_token)
    "#{token}.#{file.extension}" if original_filename
end