Not sure how your app is set up – is Tenant.current_id always empty if you’re accessing via the command line? If you try to view or modify an exiting attachment for a real tenant via the command line, will you get the correct path with this interpolation, or will you get dev?
I might consider basing the conditional on the attachment itself, instead of relying on Tenant.current_id to be set. Maybe something like:
Paperclip.interpolates :tenant_name do |attachment, style|
attachment.instance.tenant.present? ? attachment.instance.tenant.name : 'dev'
end
You could also consider moving this conditional logic to, e.g., a tenant_name method on Upload, which will probably be easier to test, and simplify the interpolation to just attachment.instance.tenant_name.
I usually put these interpolations in an initializer (usually config/initializers/paperclip.rb), so they don’t bloat the model classes, but that’s up to you.