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

How to get send_file working? #36

Closed
mbhnyc opened this issue Nov 2, 2012 · 2 comments
Closed

How to get send_file working? #36

mbhnyc opened this issue Nov 2, 2012 · 2 comments

Comments

@mbhnyc
Copy link
Contributor

mbhnyc commented Nov 2, 2012

Hey guys-

Hoping this is an easy one.. the APIs I'm building requires a facility to upload and download files, but i'm having trouble getting send_file to work (not including the right stuff).

Or is there a better way to support file sending?

Right now, i'm including

  include ActionController::Instrumentation
  include ActionController::Streaming
  include ActiveSupport::Notifications

In my controller (which inherits from RB)

But running my download method results in this error:

{"error":"system","error_description":"super: no superclass method `send_file' for #<AssetsController:0x007f89f42a5eb0>"}

I see the super call in instrumentation.rb, but not sure what else needs to be included.

Ideas? And curious how I'd have debugged this on my own..

@Sutto
Copy link
Owner

Sutto commented Nov 4, 2012

Looking at the code for actionpack and the area, try including Instrumentation post-Streaming - basically, for the super to work, it needs the send_file method to be defined first, which is what including ActionController::Streaming will do.

E.g, try this and let me know if it works:

  include ActionController::Streaming
  include ActionController::Instrumentation
  include ActiveSupport::Notifications

@mbhnyc
Copy link
Contributor Author

mbhnyc commented Nov 4, 2012

Got it, it's actually include ActionController::DataStreaming, the rest of the includes aren't necessary.

@mbhnyc mbhnyc closed this as completed Nov 6, 2012
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

2 participants