This project is archived and is in readonly mode.

#3545 ✓duplicate
David James

@_rails_html_safe clutters up YAML

Reported by David James | December 7th, 2009 @ 04:14 PM

I'm writing an HTML importer in Ruby that is not related to Rails.

One of my dependencies includes ActiveSupport 2.3.5. It sets @_rails_html_safe to false, which clutters up some YAML files i'm exporting.

My goal is to have clean YAML, so my workaround is to use remove_instance_variable:

http://gist.github.com/250891

Comments and changes to this ticket

  • David James

    David James December 7th, 2009 @ 04:17 PM

    On one hand, I understand that if I include ActiveSupport, then I am going to get all the monkey patching that comes with it. On another hand, adding instance variables to String seems a bit intrusive. Is there another way that ActiveSupport could do this? Or is there a better workaround from my perspective?

  • is

    is December 23rd, 2009 @ 08:17 PM

    The same problem with write_fragment to memcached from action and read it from nginx/memcached: I" and :@_rails_html_safeF around html.

  • is

    is December 23rd, 2009 @ 09:19 PM

    Sorry, my problem can be fixed by adding :raw => true to write_fragment.

  • Lenary

    Lenary April 22nd, 2010 @ 09:42 PM

    david, how does that monkey-patch work? i can't find any documentation for Utility.raw_string anywhere (moreover, i can't find any documentation for the module Utility)

  • David James

    David James April 22nd, 2010 @ 09:55 PM

    Lenary: you mean plain_string (not raw_string) from http://gist.github.com/250891 -- it is not a monkey patch; it is just a convenience method. Use it like this: Utility.plain_string(str)

  • Santiago Pastorino

    Santiago Pastorino April 22nd, 2010 @ 10:31 PM

    • State changed from “new” to “duplicate”

    duplicates #3535

  • Lenary

    Lenary April 22nd, 2010 @ 10:32 PM

    yeah, but is that called automatically from within YAML, or do you call it yourself?

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages