Closed GoogleCodeExporter closed 9 years ago
For now, in order to be able to use the :except option, I redefine to_xml in my
model
(see the underlined line):
def to_xml(options={})
logger.info "plop"
root = options[:root] || self.class.name.underscore
result = "<#{root}>\n"
result << " <dn>#{dn}</dn>\n"
normalize_data(@data).sort_by {|key, values| key}.each do |key, values|
next if Array(options[:except]).include?(key.to_sym)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
targets = []
values.each do |value|
if value.is_a?(Hash)
value.each do |option, real_value|
targets << [real_value, " #{option}=\"true\""]
end
else
targets << [value]
end
end
targets.sort_by {|value, attr| value}.each do |value, attr|
result << " <#{key}#{attr}>#{value}</#{key}>\n"
end
end
result << "</#{root}>\n"
result
end
Regards,
Baptiste
Original comment by baptiste@bapt.name
on 7 Jul 2008 at 3:17
It's supported in trunk.
Original comment by kou...@gmail.com
on 8 Jul 2008 at 11:20
Sorry for the noise.
Baptiste
Original comment by baptiste@bapt.name
on 8 Jul 2008 at 2:39
It's not a noise.
Thanks for your API improvement suggestion. :)
Original comment by kou...@gmail.com
on 8 Jul 2008 at 8:27
Original issue reported on code.google.com by
baptiste@bapt.name
on 7 Jul 2008 at 2:23