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

Add a note to clarify placement of before_action #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -74,6 +74,9 @@ should be cached, similar to how you use them with `before_action`.
As of Rails 3.0, you can also pass `:expires_in` with a time
interval (in seconds) to schedule expiration of the cached item.

Finally, note that only `before_action` filters that are listed
before `caches_action` will be run when serving from the cache.

The following example depicts some of the points made above:

```ruby
@@ -97,6 +100,9 @@ class ListsController < ApplicationController

# custom cache path with a symbol
caches_action :feed, cache_path: :user_cache_path

# this filter will not run when serving from the cache
before_action :set_some_value_in_session

protected
def user_cache_path