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

Consider documenting the existence of escape!()? #430

Open
brendon opened this issue Sep 16, 2016 · 2 comments
Open

Consider documenting the existence of escape!()? #430

brendon opened this issue Sep 16, 2016 · 2 comments

Comments

@brendon
Copy link

brendon commented Sep 16, 2016

In upgrading from 3 to 4 (cells seems to be the most changeable gem I've ever worked with, and I've been using it for a long time :)), I was a bit disconcerted about not having the ability to arbitrarily escape things in the view until I discovered escape! tucked in the end of Escaped.

Would you consider documenting that, or are you not wanting to draw attention to escaping in this way?

I would love to use the property escapers but in a cell view that I'm upgrading, the model has many sub-things that I'm rendering too. I suppose I should have a cell for the sub-things with properties and all that, but it seems like overkill for what I'm trying to output. There's no other way to escape the properties of a sub-model?

@george-carlin
Copy link
Contributor

I agree that this should be documented. (It's worth noting for anyone else reading this that the escape! method isn't available unless you include Escaped into the Cell.)

I find it's fairly common that I need to escape a string that can't be neatly encapsulated within a property. Yes, this is probably a sign that I should split out an entirely new 'sub cell', but as we all know, sometimes you have to sacrifice perfect design for the sake of getting things done fast.

Note that all escape!(string) does is call ERB::Util.html_escape(string), so you can always just use ERB::Util directly if you don't want to depend on escape!.

@brendon
Copy link
Author

brendon commented Apr 26, 2017

Indeed @georgemillo, I think I may have resorted to html_escape on one occasion also. If I remember correctly, the process of upgrading to Cells 4 was quite a positive learning experience once I got my head around the changes. :)

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