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

Fix ActionController::UnknownFormat on download actions #2184

Closed
Paul-Bob opened this issue Dec 18, 2023 · 2 comments · Fixed by #2269
Closed

Fix ActionController::UnknownFormat on download actions #2184

Paul-Bob opened this issue Dec 18, 2023 · 2 comments · Fixed by #2269
Assignees
Labels
Bug Something isn't working

Comments

@Paul-Bob
Copy link
Contributor

Describe the bug

When early returning an error or something on an action that have self.may_download_file = true an ActionController::UnknownFormat error is raised.

Action code:

class Avo::Actions::ExportCsv < Avo::BaseAction
  self.name = "Export csv"
  self.no_confirmation = false
  self.may_download_file = true

  def handle(**args)
    return error "Error"
  end
end
@Paul-Bob Paul-Bob added the Bug Something isn't working label Dec 18, 2023
@Paul-Bob Paul-Bob self-assigned this Dec 18, 2023
@Paul-Bob
Copy link
Contributor Author

From here

@Paul-Bob Paul-Bob mentioned this issue Dec 21, 2023
4 tasks
@adrianthedev
Copy link
Collaborator

adrianthedev commented Dec 21, 2023

I spoke with Marco about this. He didn't run into this before but he has the same recommendation as you do. Use that package.
But I would move that JS code from the controller to a custom stimulus method.

cc @Paul-Bob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants