Previously when making a request to a URL without a format and a
non-HTML Accept header the content type would be returned as
`text/html` even if it was meant to be another type like JSON.
To fix this people had to manually set a route default to whatever
was their desired content type was but this workaround couldn't
handle routes with multiple content types.
This commit fixes it by determining the extension from the request
object if there is no `:format` parameter set in the params. For
backwards compatibility if the Accept header indicates a HTML
request then the fragment is saved without an extension - otherwise
upgrading to this version of the gem would invalidate all existing
cached actions and cause possible cache storms/thundering herds
when deployed to production.
Some consideration was given to expiring both extension-less paths
and paths with `.html` when `expire_action` is called with a `"html"`
format parameter but it's probably best left to the application
developer as it could expire items from caches unexpectedly.
Fixes#18.
In Rails 5.0 positional args for HTTP request methods were deprecated
so conditionally override get to do the transition from kwargs to
the older positional format.
In Rails 5.0 we changed to converting true/false to strings whereas
previously they were passed to the controller action unchanged so
send them as strings for consistency.
Rack and Rails require Ruby 2.2.2 so we need to upgrade travis to use
only Ruby 2.2.2 and set the minimum version in the gemspec.
This means we'll have to split this peripheral gem into 2 releases. One
for the 4 apps and one for the 5 apps because the changes required by
Rails 5 won't work on older version.
In rails/rails@394b7be parameters set were changed to query strings to
behave more like a real browser. In a browser the parameters `false`
will never get sent as `false` and will always be `"false"`. Because
of this change the test for passing `false` into this `Proc` was
failing. We need to change it to check if the layout is not false rather
than relying on the value in the parameters.
This sets the dependency to allow Rails 5.
In upgrading to Rails 5 we require Ruby 2 and changes that are made here
will not work on older versions of Rails. Because of that I'm bumping
the version to 2.0.0.
This tiny commit allows to use symbols in the `:cache_path` option via
the standard behavior of `Symbol#to_proc`. The controller's instance
method pointed by the symbol should be in a `protected` scope.
According to @rafaelfranca, this repo almost doesn't have issues and
it's hard to break, so we can keep on maintaining it even now that
Rails 4.2 is out.
Once we want to remove support, we will probably announce it with an
official statement in a blog post.
[ci skip]