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

Nil error in _save_fragment when I attempt to cache an action that uses send_file #57

Open
aschmied opened this issue Mar 20, 2018 · 1 comment

Comments

@aschmied
Copy link

Environment

  • Windows 10
  • ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
  • Rails 5.0.6
  • actionpack-action_caching 1.2.0

Description

When I attempt to use caches_action on an action that sends a file using send_file I get the following nil error:

undefined method `each' for nil:NilClass
actionpack-action_caching (1.2.0) lib/action_controller/caching/actions.rb:122:in `_save_fragment'
actionpack-action_caching (1.2.0) lib/action_controller/caching/actions.rb:165:in `around'
activesupport (5.0.6) lib/active_support/callbacks.rb:405:in `public_send'
...

Repro

I pushed an app that demonstrates the crash here. The first commit is a clean app after rails new. Subsequent commits add the working controller action then introduce caching to reproduce the crash.

@dougc84
Copy link

dougc84 commented Dec 31, 2018

Receiving the same error with send_file.

My environment:

  • macOS 10.14
  • ruby 2.5.3
  • rails 5.2.2
  • actionpack-action_caching 1.2.0

This worked perfectly fine with:

  • ruby 2.2.8
  • rails 4.2.x

That said, despite the need for a gem/library like this one, the community doesn't seem to have much support behind this and would rather use header tags for most caching needs. Unfortunately, I see this issue was posted 9 months ago and was never addressed. The problem is this gem no longer solves caching files that will never change and should be cached with a store that is faster than some CDN. There are alternatives, but not when you're using Heroku (or any server with an ephemeral file system) and not without unnecessary complexity.

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

No branches or pull requests

2 participants