Module: ActiveStorageSaas::Routes
- Defined in:
- lib/active_storage_saas/routes.rb
Instance Method Summary collapse
-
#draw_active_storage_saas_routes(prefix: '/rails/active_storage', blobs_controller: 'active_storage_saas/blobs', representations_controller: 'active_storage_saas/representations', disk_controller: 'active_storage_saas/disk', direct_uploads_controller: 'active_storage_saas/direct_uploads', **option_overrides) ⇒ Object
rubocop: disable Layout/LineLength.
Instance Method Details
#draw_active_storage_saas_routes(prefix: '/rails/active_storage', blobs_controller: 'active_storage_saas/blobs', representations_controller: 'active_storage_saas/representations', disk_controller: 'active_storage_saas/disk', direct_uploads_controller: 'active_storage_saas/direct_uploads', **option_overrides) ⇒ Object
rubocop: disable Layout/LineLength
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/active_storage_saas/routes.rb', line 4 def draw_active_storage_saas_routes( prefix: '/rails/active_storage', blobs_controller: 'active_storage_saas/blobs', representations_controller: 'active_storage_saas/representations', disk_controller: 'active_storage_saas/disk', direct_uploads_controller: 'active_storage_saas/direct_uploads', **option_overrides ) scope prefix do get '/blobs/:signed_id/*filename' => "#{blobs_controller}#show", as: :rails_service_blob get '/representations/:signed_blob_id/:variation_key/*filename' => "#{representations_controller}#show", as: :rails_blob_representation get '/disk/:encoded_key/*filename' => "#{disk_controller}#show", as: :rails_disk_service put '/disk/:encoded_token' => "#{disk_controller}#update", as: :update_rails_disk_service post '/direct_uploads' => "#{direct_uploads_controller}#create", as: :rails_direct_uploads match '/direct_uploads/callback/:signed_id' => "#{direct_uploads_controller}#callback", as: :rails_direct_upload_callback, via: %i[get post] end direct :rails_blob do |blob, | route_for(:rails_service_blob, blob.signed_id, blob.filename, ) end resolve('ActiveStorage::Blob') { |blob, | route_for(:rails_blob, blob, .merge(option_overrides)) } resolve('ActiveStorage::Attachment') { |, | route_for(:rails_blob, .blob, .merge(option_overrides)) } direct :rails_representation do |representation, | signed_blob_id = representation.blob.signed_id variation_key = representation.variation.key filename = representation.blob.filename route_for(:rails_blob_representation, signed_blob_id, variation_key, filename, ) end resolve('ActiveStorage::Variant') { |variant, | route_for(:rails_representation, variant, .merge(option_overrides)) } resolve('ActiveStorage::Preview') { |preview, | route_for(:rails_representation, preview, .merge(option_overrides)) } end |