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

Action caching per user. #47

Open
vishaljagtap-tudip opened this issue May 18, 2017 · 4 comments
Open

Action caching per user. #47

vishaljagtap-tudip opened this issue May 18, 2017 · 4 comments

Comments

@vishaljagtap-tudip
Copy link

I am using "actionpack-action_caching 1.1.1" gem for applying action caching in our rails (4.2.5) application. Successfully able to cache the desired actions in controller, but when logging with other user it is showing the same cached pages of previous user. How should I cache differently for each user?

Any help is appreciated!

@yoniamir
Copy link

@vishaljagtap-tudip You can either-

  1. Extract user specific content to the layout (like a menu bar) and setting the layout: false option.
  2. Set a cache_key to take the user_id into consideration.

@vishaljagtap-tudip
Copy link
Author

vishaljagtap-tudip commented May 22, 2017

@yoniamir
I have tried with your given solution but when I am using option layout: false it is showing all html code on view page.

@yoniamir
Copy link

@vishaljagtap-tudip
Is your user specific html in a layout file? (e.g. application.html.erb)

@yaxhpal
Copy link

yaxhpal commented Sep 18, 2017

This happened to me also. Although, I was able to cache an action but in another action where I wanted to do similar caching, Rails delivered page without setting Content Type header to "text/html; charset=UTF-8". It simply returning with "; charset=UTF-8" header. This displays page as text i.e. HTML source. Do I need to set Content Type header?

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

3 participants