To_xml :methods generating escaped XML

Howdy. Ruby N. here.

I have a couple of methods in one of my models:

def program_asset
if promo?
elsif feature?
play_id = self[:play_id]
my_play = Playdate.find(play_id)
my_fid = my_play[:fid]
logger.fatal "Came across a log item that was neither a promo nor
a feature: " + self

def program_asset_xml
program_asset.to_xml(:skip_instruct => true)

include the first-level associations.

alias_method :ar_to_xml, :to_xml
def to_xml(options = {})
default_methods = [:program_asset_xml]
options[:methods] = (options[:methods] ? options[:methods] +
default_methods : default_methods )

Sort of works okay, except here is a snippet of XML that gets returned
to a browser or client:

<artesia_did type=“integer”></artesia_did>


The :include-d program asset’s XML gets converted into an escaped
string, where the angle brackets have been replaced by < and > .
What am I doing wrong?

Thanks very much in advance for any help, as well as any other
suggestions you may have!

Bump. Why is it that I have to CGI.unescapeHTML the output in order for
it to appear correct on the client side? CGI.unescapeHTML introduces a
big performance hit, for some reason (and that could be another issue).

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs