Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Incorrect parsing of HTML when viewing an Equipment Object #35

Closed
ncmaas opened this issue May 31, 2012 · 3 comments
Closed

Incorrect parsing of HTML when viewing an Equipment Object #35

ncmaas opened this issue May 31, 2012 · 3 comments

Comments

@ncmaas
Copy link
Contributor

ncmaas commented May 31, 2012

When viewing the details page for an Equipment Object, the "p" "small" and "/br" HTML tags are visible.   also shows up literally, rather than as the space it is supposed to create.

@adambray
Copy link
Contributor

This has to do with how Rails 3 treats all strings as not html safe (as opposed to Rails 2, which trusted everything by default). Thus all strings in the view are by default sanitized.

To fix this, you'll need to mark the appropriate strings using the '.html_safe' method.

-Adam

On May 31, 2012, at 9:00 AM, ncmaas wrote:

When viewing the details page for an Equipment Object, the

and
tags are visible.


Reply to this email directly or view it on GitHub:
#35

@ncmaas
Copy link
Contributor Author

ncmaas commented Jun 1, 2012

So, there are several places where this same error occurs. Let's consolidate them all into one issue: here!

When viewing an equipment model's show page, "This is a " is surrounded by HTML. Solution: change line 4 of app/views/equipment_models to be <%=@equipment_model.formatted_description.html_safe %>

When viewing an equipment model's show page, the serial numbers were formatted incorrectly. Solution: change line 102 to <%= "
  Serial #: #{equipment_object.serial}".html_safe unless equipment_object.serial.blank? %>

ncmaas added a commit that referenced this issue Jun 1, 2012
@ncmaas
Copy link
Contributor Author

ncmaas commented Jun 4, 2012

I've fixed this in all the places I've managed to find it. yay!

@ncmaas ncmaas closed this as completed Jun 4, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants