Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rails_blob_path error #1

Open
Xavoski opened this issue Apr 29, 2019 · 2 comments
Open

rails_blob_path error #1

Xavoski opened this issue Apr 29, 2019 · 2 comments

Comments

@Xavoski
Copy link

Xavoski commented Apr 29, 2019

Hello,

If i use standard config.active_storage.service = :local, i can upload and download a pdf.
But the download broke when i change it to config.active_storage.service = :db.

ruby '2.5.1'
gem 'rails', '~> 5.2.3'
gem 'pg', '>= 0.18', '< 2.0'

psql (PostgreSQL) 10.7 (Ubuntu 10.7-1.pgdg18.04+1)

To download the document, i have this in my show.html.erb page:
<%= link_to("Document", rails_blob_path(@person.file, disposition: "attachment")) %>

_form.html.erb:
<%= form.file_field :file %>

Controller:
Just added :file to allowed parameters list.

Model:
has_one_attached :file

The error i see in terminal is:
Started GET "/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBDQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--85226e56d7362d1f5c786ca289dc03009674c195/railsScaffoldCommand.pdf?disposition=attachment" for ::1 at 2019-04-29 17:45:01 -0300
Processing by ActiveStorage::BlobsController#show as PDF
Parameters: {"disposition"=>"attachment", "signed_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBDQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--85226e56d7362d1f5c786ca289dc03009674c195", "filename"=>"railsScaffoldCommand"}
ActiveStorage::Blob Load (0.4ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [["id", 3], ["LIMIT", 1]]
↳ /home/junior/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
Completed 500 Internal Server Error in 2ms (ActiveRecord: 0.4ms)

Thanks for your work. I appreciate your effort on this gem.

@markaschneider
Copy link
Contributor

You might want to try applying my pull request or my fork (master branch) in case that resolves your issue. The pull request fixes some issues, although I haven't specifically tested for yours.

@paul-at
Copy link
Contributor

paul-at commented Mar 21, 2023

Was this closed by #2 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants