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

Caching doesn't escape loaded values from cache store #109

Closed
Imomoi opened this issue Feb 27, 2012 · 5 comments
Closed

Caching doesn't escape loaded values from cache store #109

Imomoi opened this issue Feb 27, 2012 · 5 comments

Comments

@Imomoi
Copy link
Contributor

Imomoi commented Feb 27, 2012

In Rails 3.2.1 cells doesn't escape cached values after reading them from database.

Our workaround for this issue is config/initializers/cells_fix.rb:

Cell::Base.class_eval do
  def render_state(state, *args)
    rendered_state = super(state, *args)
    return rendered_state.html_safe if rendered_state.respond_to?(:html_safe)
    rendered_state
  end
end
@apotonick
Copy link
Member

Huh? Does that appear in a cached scenario, only? Why isn't the cached view escaped already, then?

@Imomoi
Copy link
Contributor Author

Imomoi commented Mar 1, 2012

It's appear only when cell is loaded from cache. When cell renders without cache all works correctly.

In Rails they do safe_concat after getting value from cache: https://github.com/rails/rails/blob/master/actionpack/lib/action_view/helpers/cache_helper.rb#L36

@apotonick
Copy link
Member

But... the cached view should be escaped already. They (the Rails core) change this every other week. Did that work for you in Rails 3.0 and 3.1?

@Imomoi
Copy link
Contributor Author

Imomoi commented Mar 2, 2012

hm, dunno. We are using caching since Rails 3.2 only.

@apotonick
Copy link
Member

I close this because we don't do escaping anymore in Cells 4 - only for defined properties, which should make this issue obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants