New mime type. Works in windows, fails in ubuntu

Hi,

I am generating some SVG content from my app. To get that working I’ve
done the next:

Add line in /config/initializers/mime_types.rb$:
Mime::Type.register “application/xhtml+xml”, :svg

In my controller I have now added to the respond_to:
format.svg { render :action => “svg.rhtml”, :layout => false }

svg.rhtml is something like:

<% for session in @online_sessions %>
<text id=“user” x=“325” y=“80” width=“200” height=“20” … >
<%= getUsernameFromID(session.user_id) %>

<% end %>


Now. When I have the new line in the mime_types.rb and try to access the
app I get:

“This XML file does not appear to have any style information associated
with it. The document tree is shown below.”

The only thing I see is the XML model. No layout.

If I remove the new line then everything works 8-P

The funny thing is that all works fine in the environment I use in
Windows with InstantRails. And the same thing causes this effect when I
run it in Ubuntu. Same versions for everything and using webrick as
server in both.

Any good ideas?

Thanks!

Hi again,

I have to make some corrections to my problem. I have verified that the
guilty one is not Ubuntu.

The problem I describe only occurs with Firefox (!?!). When adding the
new mime type accessing any page of the application just returns the
data model in XML. No layout.

There is no such problem if I use IE or Opera. Behaves same with
InstantRails or directly in the Ubuntu machine.

Any clues to solve the mistery?

Cheers.

Hi again again,

So now I think I fixed the problem. The MIME type was wrong.
I had Mime::Type.register “application/xhtml+xml”, :svg

And the right one was Mime::Type.register “image/svg+xml”, :svg

I don’t know why only Firefox was affected but now those three browsers
get the right stuff from the server.

Cheers!

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