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

Rails 3 escaping #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

rchekaluk
Copy link

When upgrading my app to Rails 3 I encountered an issue with collection_table escaping the generated content. I tried various ways of working around this, and none worked: (a) calling html_safe against each of the strings I passed to collection_table, (b) using <%=raw in the first line, and (c) putting each line into its own erb <%=raw %> line.

The solution that worked was to modify content_tag calls in table_helper to disable the escaping.

Here are some of the references I used:
http://stackoverflow.com/questions/3863844/rails-how-to-build-table-in-helper-using-content-tag/
http://asciicasts.com/episodes/204-xss-protection-in-rails-3/
http://railsdispatch.com/posts/security/
http://yehudakatz.com/2010/02/01/safebuffers-and-rails-3-0/

@averissimo
Copy link

+1

1 similar comment
@scottillogical
Copy link

+1

@marcandre
Copy link

Pull request is not the right way to go. See my pull request #8

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

Successfully merging this pull request may close these issues.

4 participants