I have extended RefineryCMS blog/admin/posts controller with Export action, which export post to xml and save it to file. I need export all translated versions of post. When I click export it saves all files, but all files have same locale.
Is it anything wrong with my code:
def generate_xml_by_locales
translated_locales.each do |l|
::I18n.locale = l
file = File.new("blog_#{l}.xml", "wb")
xml = Builder::XmlMarkup.new :target => file
xml.instruct!
xml.blog do
xml.title post.title
xml.description "Sixteenth installment of development diary"
xml.language l.to_s
xml.author "Dan"
xml.date post.created_at
xml.category "diary"
xml.text post.body
end
file.close
end
end
Thanks for help.