Skip to content

Action caching per user. #47

Open
Open
@vishaljagtap-tudip

Description

@vishaljagtap-tudip

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!

Activity

yoniamir

yoniamir commented on May 22, 2017

@yoniamir

@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

vishaljagtap-tudip commented on May 22, 2017

@vishaljagtap-tudip
Author

@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

yoniamir commented on May 22, 2017

@yoniamir

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

yaxhpal

yaxhpal commented on Sep 18, 2017

@yaxhpal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @yoniamir@yaxhpal@vishaljagtap-tudip

        Issue actions

          Action caching per user. · Issue #47 · rails/actionpack-action_caching