I'm not sure why but when I set this setting it can't compile
set :static_cache_control, [:public, :max_age => 300]
This is what I get
syntax error, unexpected tASSOC, expecting ']' (SyntaxError)
set :static_cache_control, [:public, :max_age => 300]
^
I just want to set "expires" header to css, javaascript and image files.
Thanks.
I'm guessing you're using Ruby 1.8.7. It seems that the syntax shown in the Sinatra docs, where the last entry in an array is converted to a hash, was introduced in Ruby 1.9 and isn't in 1.8.7.
Try explicitly wrapping the hash entries with braces {}
:
set :static_cache_control, [:public, {:max_age => 300}]
(Or upgrade Ruby.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With